#############################################################################

[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)));
}

#############################################################################
