From 93115467947f00f4714d1358a030267b28acaa7a Mon Sep 17 00:00:00 2001 From: tlatorre Date: Tue, 4 Sep 2018 16:51:41 -0500 Subject: add a function to return the kahan sum of an array For some reason the fit seems to have trouble with the kinetic energy. Basically, it seems to "converge" even though when you run the minimization again it finds a better minimum with a lower energy. I think this is likely due to the fact that for muons the kinetic energy only really affects the range of the muon and this is subject to error in the numerical integration. I also thought that maybe it could be due to roundoff error in the likelihood calculation, so I implemented the Kahan summation to try and reduce that. No idea if it's actually improving things, but I should benchmark it later to see. --- src/misc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/misc.h') diff --git a/src/misc.h b/src/misc.h index c1897d9..c93afba 100644 --- a/src/misc.h +++ b/src/misc.h @@ -3,6 +3,7 @@ #include /* for size_t */ +double kahan_sum(double *x, size_t n); double interp1d(double x, double *xp, double *yp, size_t n); int isclose(double a, double b, double rel_tol, double abs_tol); int allclose(double *a, double *b, size_t n, double rel_tol, double abs_tol); -- cgit