diff --git a/ex-1/main.c b/ex-1/main.c index 21214d0..9f37888 100644 --- a/ex-1/main.c +++ b/ex-1/main.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include "landau.h" @@ -10,10 +9,10 @@ #include "bootstrap.h" -/* Here we generate random numbers in a uniform - * range and by using the quantile we map them - * to a Landau distribution. Then we generate an - * histogram to check the correctness. +/* Here we generate random numbers following + * the Landau distribution and run a series of + * test to check if they really belong to such a + * distribution. */ int main(int argc, char** argv) { // initialize an RNG @@ -23,17 +22,14 @@ int main(int argc, char** argv) { // prepare histogram size_t samples = 100000; double* sample = calloc(samples, sizeof(double)); - size_t bins = 40; double min = -10; double max = 10; - gsl_histogram* hist = gsl_histogram_alloc(bins); - gsl_histogram_set_ranges_uniform(hist, min, max); /* Sample generation * - * Sample points from the Landau - * distribution and fill the histogram. + * Sample points from the Landau distribution + * using the GSL Landau generator. */ fprintf(stderr, "# Sampling\n"); fprintf(stderr, "generating %ld points... ", samples); @@ -41,11 +37,10 @@ int main(int argc, char** argv) { for(size_t i=0; i D) D = d; } - fprintf(stderr, "\n\n# Kolmogorov-Smirnov test\n"); double beta = kolmogorov_cdf(D, samples); // print the results @@ -152,7 +147,6 @@ int main(int argc, char** argv) { // clean up and exit - gsl_histogram_free(hist); gsl_rng_free(r); free(sample); return EXIT_SUCCESS;