diff --git a/ex-3/main.c b/ex-3/main.c index 3b7948f..df87931 100644 --- a/ex-3/main.c +++ b/ex-3/main.c @@ -37,9 +37,9 @@ int main(int argc, char **argv) { fprintf(stderr, "\t-h\tShow this message.\n"); fprintf(stderr, "\t-i\tPrint the histogram to stdout.\n"); fprintf(stderr, "\t-I\tPrint *only* the histogram.\n"); - fprintf(stderr, "\t-n N\tThe number of events to generate.\n"); - fprintf(stderr, "\t-t N\tThe number of θ bins.\n"); - fprintf(stderr, "\t-p N\tThe number of φ bins.\n"); + fprintf(stderr, "\t-n N\tThe number of events to generate. (default: 50000)\n"); + fprintf(stderr, "\t-t N\tThe number of θ bins. (default: 30)\n"); + fprintf(stderr, "\t-p N\tThe number of φ bins. (default: 60)\n"); return EXIT_FAILURE; } } diff --git a/ex-4/main.c b/ex-4/main.c index 03ecd2b..e2b0e4c 100644 --- a/ex-4/main.c +++ b/ex-4/main.c @@ -13,20 +13,20 @@ int parser(size_t *N, size_t *n, double *p_max, char argc, char **argv) { for (size_t i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-N")) *N = atol(argv[++i]); - else if (!strcmp(argv[i], "-n")) *n = atol(argv[++i]); + if (!strcmp(argv[i], "-n")) *N = atol(argv[++i]); + else if (!strcmp(argv[i], "-b")) *n = atol(argv[++i]); else if (!strcmp(argv[i], "-p")) *p_max = atof(argv[++i]); else { - fprintf(stderr, "Usage: %s -[hiIntp]\n", argv[0]); + fprintf(stderr, "Usage: %s -[hnbp]\n", argv[0]); fprintf(stderr, "\t-h\tShow this message.\n"); - fprintf(stderr, "\t-N integer\tThe number of events to generate.\n"); - fprintf(stderr, "\t-n integer\tThe number of bins of the histogram.\n"); - fprintf(stderr, "\t-p float\tThe maximum value of momentum.\n"); - return EXIT_FAILURE; + fprintf(stderr, "\t-n N\tThe number of events to generate. (default: 50000)\n"); + fprintf(stderr, "\t-b N\tThe number of bins of the histogram. (default: 50)\n"); + fprintf(stderr, "\t-p PMAX\tThe maximum value of momentum. (default: 10)\n"); + return 0; } } - return EXIT_SUCCESS; + return 1; } @@ -39,10 +39,14 @@ int main(int argc, char **argv) size_t n = 50; // number of bins. double p_max = 10; // maximum value of momentum module. int res = parser(&N, &n, &p_max, argc, argv); - if (res == 0) printf("\nGenerating histogram with:\n" + if (res == 1) + { + printf("\nGenerating histogram with:\n" "%ld points\n" "%ld bins\n" "p_max = %.3f\n\n", N, n, p_max); + } + else return EXIT_FAILURE; // printf("step: \t%.5f\n", step); @@ -143,8 +147,8 @@ int main(int argc, char **argv) double x = 10; int max_iter = 100; double prec = 1e-7; - int status; - const gsl_min_fminimizer_type *T = gsl_min_fminimizer_brent; + int status = GSL_CONTINUE; + const gsl_min_fminimizer_type *T = gsl_min_fminimizer_brent; gsl_min_fminimizer *s = gsl_min_fminimizer_alloc(T); gsl_min_fminimizer_set(s, &func, x, min_p, max_p); diff --git a/ex-6/main.c b/ex-6/main.c index ea2da25..a204cc8 100644 --- a/ex-6/main.c +++ b/ex-6/main.c @@ -140,17 +140,17 @@ int main(int argc, char **argv) { else if (!strcmp(argv[i], "-m")) opts.mode = argv[++i]; else if (!strcmp(argv[i], "-n")) opts.noise = atof(argv[++i]); else { - fprintf(stderr, "Usage: %s -[cdoebsh]\n", argv[0]); + fprintf(stderr, "Usage: %s -[cdoebsrmh]\n", argv[0]); fprintf(stderr, "\t-h\t\tShow this message.\n"); fprintf(stderr, "\t-c\t\tPrint the convolved histogram to stdout.\n"); fprintf(stderr, "\t-d\t\tAttempt and print the deconvolved histogram.\n"); fprintf(stderr, "\t-o\t\tPrint the original histogram to stdout.\n"); - fprintf(stderr, "\t-e N\t\tThe number of events.\n"); - fprintf(stderr, "\t-b N\t\tThe number of θ bins.\n"); - fprintf(stderr, "\t-s SIGMA\tThe sigma of gaussian kernel.\n"); - fprintf(stderr, "\t-r N\t\tThe number of RL deconvolution rounds.\n"); - fprintf(stderr, "\t-m MODE\t\tThe deconvolution mode: 'fft' or 'rl'.\n"); - fprintf(stderr, "\t-n MU\t\tThe mean (μ) of Poisson noise to add to the convolution.\n"); + fprintf(stderr, "\t-e N\t\tThe number of events. (default: 50000)\n"); + fprintf(stderr, "\t-b N\t\tThe number of θ bins. (default: 150)\n"); + fprintf(stderr, "\t-s SIGMA\tThe sigma of gaussian kernel.(default: 0.8)\n"); + fprintf(stderr, "\t-r N\t\tThe number of RL deconvolution rounds. (default: 3)\n"); + fprintf(stderr, "\t-m MODE\t\tThe deconvolution mode: 'fft' or 'rl'. (default: 'fft')\n"); + fprintf(stderr, "\t-n MU\t\tThe mean (μ) of Poisson noise to add to the convolution. (default: 0)\n"); return EXIT_FAILURE; } } diff --git a/ex-7/main.c b/ex-7/main.c index 0a05440..67f146e 100644 --- a/ex-7/main.c +++ b/ex-7/main.c @@ -38,11 +38,11 @@ int main(int argc, char **argv) { fprintf(stderr, "Usage: %s -[hmisnw]\n", argv[0]); fprintf(stderr, " -h\t\tShow this message.\n"); fprintf(stderr, " -m MODE\tThe training mode to use: 'fisher' for \n\t\t" - "Fisher linear discriminant, 'percep' for perceptron.\n"); + "Fisher linear discriminant, 'percep' for perceptron. (default: 'fisher')\n"); fprintf(stderr, " -i N\t\tThe number of training iterations " - "(for perceptron only).\n"); - fprintf(stderr, " -s N\t\tThe number of events in signal class.\n"); - fprintf(stderr, " -n N\t\tThe number of events in noise class.\n"); + "(for perceptron only). (default: 5)\n"); + fprintf(stderr, " -s N\t\tThe number of events in signal class. (default: 800)\n"); + fprintf(stderr, " -n N\t\tThe number of events in noise class. (default: 1000)\n"); fprintf(stderr, " -w W₁ W₂ B\tSet weights and bias (if pre-trained).\n"); return EXIT_FAILURE; } diff --git a/notes/todo b/notes/todo index 19c8072..e69de29 100644 --- a/notes/todo +++ b/notes/todo @@ -1,8 +0,0 @@ -- es 1 bootstrap for median -- es 2 -- es 3 -- rifare es 4 -- es 5 -- es 6 -- es 7 -- scrivere una specie di indice sui programmi (usati dove, linguaggio, --help...)