From df7a630094e3ff4e75e5eb9176c468227fd24790 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sat, 4 Apr 2020 20:12:58 +0200 Subject: [PATCH] ex-1: print the mode error --- ex-1/tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ex-1/tests.c b/ex-1/tests.c index 09bb892..b2e85f8 100644 --- a/ex-1/tests.c +++ b/ex-1/tests.c @@ -60,7 +60,7 @@ double neg_landau_pdf(double x, void* params) { * interval for the optimisation. */ double numeric_mode(double min, double max) { - // create funtion + // create function gsl_function pdf; pdf.function = &neg_landau_pdf; pdf.params = NULL; @@ -86,6 +86,8 @@ double numeric_mode(double min, double max) { } while (status == GSL_CONTINUE && iter < max_iter); + fprintf(stderr, "mode error: %.3g\n", max - min); + // Free memory gsl_min_fminimizer_free(s); return guess; @@ -107,7 +109,7 @@ double abs_landau_pdf(double x, void* params_) { * computer with `numeric_mode(min, max)`. */ double numeric_fwhm(double min, double max, double mode) { - // create funtion + // create function gsl_function pdf; pdf.function = &abs_landau_pdf; double params [1];