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

[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]

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