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: Sarrah Bastawala
Subject: [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs
Date: Tue, 5 Apr 2022 07:45:43 -0400 (EDT)

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

[comment #4 comment #4:]
> i'm not set up to compile c-code, so haven't checked your 
patch, but looking at sum, and having played with some other 
functions that have odd outputs from different empty inputs,
the following are also expected by matlab (2021b):

All of these gave me the correct output on my fix, maybe it was that they
already worked.

> I see now that sum already has a number of empty input tests in
/libinterp/corefcn/data.cc, but strangely none for a [] input. so you should
verify that your fix doesn't break any of those tests, and add BISTs to
data.cc that capture this fix.)  
I did verify that all tests passed in data.cc using make check before
submitting the patch, so exiting tests should not be an issue. If we do decide
to go ahead with the expected output for this fix, I will add the required
BISTs.
> 
> and do any other functions than sum rely on this function in mx-inlines.cc?
would want to make sure it doesn't change or break any other functions while
trying to fix sum.

However this does seem to be a problem. Most of the functions like prod, dot,
sumsq, that use the do_mx_red_op function in mx-inlines.cc, are mentioned in
bug #51333, and which fail by return empty vectors where they should be
returning unit sums for some testcases provided in the bug's comments. So
while my fix would work for all edge cases in sum, it wouldnt be the right
logic to apply for some other functions. I am confused as to whether this can
possibly be resolved by code logic, or if the problem lies in how we are
re-using the matrix reduction function.
> 
> for commit messages, use imperative tense, not past tense (tell what happens
when i apply the patch, not what you did in creating it.) So "Resolve" not
"Resolved",  Extend" not "Extended", etc.

I will change this from the next commit onwards.


    _______________________________________________________

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]