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

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

[Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs
Date: Tue, 5 Apr 2022 01:21:57 -0400 (EDT)

Follow-up Comment #6, bug #61690 (project octave):

Most of mx-inlines.cc was written a long time ago.  At some point, a
"zero_by_zero" function was added to the dim_vector class that appears to be
the same as the check


dims.ndims () == 2 && dims(0) == 0 && dims(1) == 0


It also seems bad to repeat most of the exact same test twice.

So maybe write


if (dims.zero_by_zero ())
  {
     if (dim == 0)
       dims(0) = 1;
     else if (dim == 1)  // OR just "else" if we are certain
       dims(1) = 1;      // that DIM can be only 0 or 1 here.
  }




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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