octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58089] [Feature Request] sum along multiple d


From: Guillaume
Subject: [Octave-bug-tracker] [bug #58089] [Feature Request] sum along multiple dimensions
Date: Thu, 9 Apr 2020 18:14:04 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #5, bug #58089 (project octave):


diff -r 7ac8b3188b27 libinterp/corefcn/data.cc
--- a/libinterp/corefcn/data.cc Wed Apr 08 16:03:51 2020 -0400
+++ b/libinterp/corefcn/data.cc Thu Apr 09 23:09:42 2020 +0100
@@ -2953,6 +2953,8 @@
   int dim = -1;
   if (nargin == 2)
     {
+      if (args(1).length () != 1)
+        error ("sum: dimension must be a scalar");
       dim = args(1).int_value () - 1;
       if (dim < 0)
         error ("sum: invalid dimension DIM = %d", dim + 1);


but I guess one could also check whether the input is an integer and apply a
similar fix to all of the functions listed in comment #2. I can try and have a
look.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58089>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]