From e6b94e6c56f94981ff155fdb11be0e8509f93dec Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Tue, 8 Aug 2017 16:48:19 +0200
Subject: [PATCH] consider negative values in joint PDF of scalars

this is a significant change of the behavior of joint_rspace_PDF,
because I didn't realize I was doing something stupid...
---
 bfps/cpp/field.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bfps/cpp/field.cpp b/bfps/cpp/field.cpp
index 197ccb5d..6f2ff938 100644
--- a/bfps/cpp/field.cpp
+++ b/bfps/cpp/field.cpp
@@ -1235,8 +1235,8 @@ int joint_rspace_PDF(
     {
         for (unsigned int i=0; i<4; i++)
         {
-            bin1size[i] = max_f1_estimate[0] / nbins;
-            bin2size[i] = max_f2_estimate[0] / nbins;
+            bin1size[i] = 2*max_f1_estimate[0] / nbins;
+            bin2size[i] = 2*max_f2_estimate[0] / nbins;
         }
     }
 
@@ -1279,8 +1279,8 @@ int joint_rspace_PDF(
             }
             else if (fc == ONE)
             {
-                bin1 = int(floor(f1->rval(rindex)/bin1size[3]));
-                bin2 = int(floor(f2->rval(rindex)/bin2size[3]));
+                bin1 = int(floor((f1->rval(rindex) + max_f1_estimate[0])/bin1size[3]));
+                bin2 = int(floor((f2->rval(rindex) + max_f2_estimate[0])/bin2size[3]));
             }
             if ((bin1 >= 0 && bin1 < nbins) &&
                 (bin2 >= 0 && bin2 < nbins))
-- 
GitLab