changeset 29121:54509b7fddd3

mean.m: Allow NaN as input for geometric mean (bug #59410). * scripts/statistics/mean.m: Do not throw an error if input for geometric mean contains NaN.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 12 Nov 2020 14:38:38 +0100
parents eb6599cf2db5
children 5b8885af4e2f
files scripts/statistics/mean.m
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/mean.m	Thu Nov 12 18:15:52 2020 +0100
+++ b/scripts/statistics/mean.m	Thu Nov 12 14:38:38 2020 +0100
@@ -152,7 +152,7 @@
     case "a"
       y = sum (x, dim) / n;
     case "g"
-      if (all (x(:) >= 0))
+      if (! any (x(:) < 0))
         y = exp (sum (log (x), dim) ./ n);
       else
         error ("mean: X must not contain any negative values");