#############################################################################
#                                                                           #
#  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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[2] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[2]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (3)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[3] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[3]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (4)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[4] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[4]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (5)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[5] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[5]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (7)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[6] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[6]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (10)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[7] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[7]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (15)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[8] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[8]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (20)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[9] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[9]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multinormal distribution
\#define dim (100)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[10] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[10]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim

# multinormal distribution with correlation matrix of AR(1) process
\#define dim (100)
distr[26] = unur_distr_multinormal_ar1(dim,NULL,0.5);
\#undef dim

\#define dim (100)
distr[27] = unur_distr_multinormal_ar1(dim,NULL,0.9);
\#undef dim

\#define dim (100)
distr[28] = unur_distr_multinormal_ar1(dim,NULL,0.99);
\#undef dim

\#define dim (100)
distr[29] = unur_distr_multinormal_ar1(dim,NULL,0.999);
\#undef dim


# random distribution with non-normal marginals
\#define dim (5)
double beta_params[2] = {5.,3.};
double gamma_params[1] = {7.};
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)");
distr[11] = unur_distr_cvec_new(dim);
for (i=0; i<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
unur_distr_cvec_set_mean(distr[11],mean);
do { 
   unur_sample_matr(covar_gen,covar);
} while (unur_distr_cvec_set_covar(distr[11],covar) != UNUR_SUCCESS);
unur_distr_cvec_set_marginal_list(distr[11],
	unur_distr_normal(NULL,0),
	unur_distr_cauchy(NULL,0),
	unur_distr_exponential(NULL,0),
	unur_distr_beta(beta_params,2),
	unur_distr_gamma(gamma_params,1));
unur_distr_cvec_set_stdmarginal_list(distr[11],
	unur_distr_normal(NULL,0),
	unur_distr_cauchy(NULL,0),
	unur_distr_exponential(NULL,0),
	unur_distr_beta(beta_params,2),
	unur_distr_gamma(gamma_params,1));
unur_distr_set_name(distr[11],"non-normal");
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# standard "multinormal" distribution of dimension 1
distr[12] = unur_distr_multinormal(1,NULL,NULL);


# "multinormal" distribution of dimension 1
\#define dim (1)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[13] = unur_distr_multinormal(dim,mean,covar); 
} while (distr[13]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# "invalid" distribution
# (marginal generators cannot be initialized)
\#define dim (2)
double covar[] = { 2., 1.,  1., 3. };
distr[14] = unur_distr_cvec_new(dim);
unur_distr_cvec_set_covar(distr[14],covar);
unur_distr_cvec_set_mean(distr[14],NULL);
unur_distr_cvec_set_marginal_list(distr[14],
  unur_distr_normal(NULL,0),
  unur_distr_cont_new() );
unur_distr_cvec_set_stdmarginal_list(distr[14],
  unur_distr_normal(NULL,0),
  unur_distr_cont_new() );
unur_distr_set_name(distr[14],"no_marginal_generator");
\#undef dim


# standard multinormal distribution
distr[15] = unur_distr_multicauchy(3,NULL,NULL);


# multicauchy distribution, dim = 3 
double mean[]  = { 1., 2., 3. };
double covar[] = { 2., 2., 1.,   2., 4., 3.,   1., 3., 3. };
distr[16] = unur_distr_multicauchy(3,mean,covar);


# random multicauchy 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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[17] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[17]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (3)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[18] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[18]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (4)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[19] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[19]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (5)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[20] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[20]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (7)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[21] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[21]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (10)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[22] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[22]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (15)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[23] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[23]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (20)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[24] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[24]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# random multicauchy distribution
\#define dim (100)
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<dim; i++) 
   mean[i] = unur_sample_cont(mean_gen);
do { 
   unur_sample_matr(covar_gen,covar);
   distr[25] = unur_distr_multicauchy(dim,mean,covar); 
} while (distr[25]==NULL);
unur_distr_free(covar_distr);
unur_free(covar_gen);
unur_free(mean_gen); 
\#undef dim


# number of distributions: 33


[validate - test chi2:]

#  + ... pass test
#  0 ... fail to initialize generator
#  - ... fail test
#  . ... do not run test
#  # ... comment
#
# generators:
#  [0] ... default variant
#  [1] ... default variant but reinitialized with changed distribution
#
#gen    0  1	# distribution
#---------------------------------------------
  <0>	+  +	# 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]

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