changeset 23839:724fe19b50dc

center.m: Use bsxfun rather than broadcasting (bug #51249). Don't use automatic broadcasting until it works on sparse & diagonal matrices. * center.m: Replace broadcasting with bsxfun. Add note about when to remove patch.
author Rik <rik@octave.org>
date Tue, 08 Aug 2017 08:53:37 -0700
parents 6e0fd7e3c262
children dca84dfe167f
files scripts/statistics/base/center.m
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/base/center.m	Mon Aug 07 15:05:19 2017 -0700
+++ b/scripts/statistics/base/center.m	Tue Aug 08 08:53:37 2017 -0700
@@ -69,7 +69,10 @@
   if (n == 0)
     retval = x;
   else
-    retval = x - mean (x, dim);
+    ## FIXME: Use bsxfun, rather than broadcasting, until broadcasting
+    ##        supports diagonal and sparse matrices (Bugs #41441, #35787).
+    retval = bsxfun (@minus, x, mean (x, dim));
+    ## retval = x - mean (x, dim);   # automatic broadcasting
   endif
 
 endfunction