[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: |
Wed, 13 Apr 2022 06:17:25 -0400 (EDT) |
Follow-up Comment #11, bug #61690 (project octave):
[comment #10 comment #10:]
> it's worth checking that the tests in those other functions do still match
matlab output.
I have now crosschecked all provided tests in the data.cc file for relevant
functions such as cumprod, cumsum, prod and sum, and also added some extra
tests that work against both Octave and Matlab. The only function now
remaining slightly incompatible with Matlab is dot, and I believe that should
be addressed in bug #51333 as the changes would have to be made to a seperate
file.
Here are some examples of how my change fixes the bug :
octave:1> sum([])
ans = 0
octave:2> sum([],1)
ans = [](1x0)
octave:3> sum([],2)
ans = [](0x1)
octave:4> prod([])
ans = 1
octave:5> prod([],1)
ans = [](1x0)
octave:6> prod([],2)
ans = [](0x1)
octave:7> sum(ones(3,0),2)
ans =
0
0
0
octave:8> sum(ones(1,0),1)
ans = [](1x0)
octave:9> sum(ones(3,0,4,2))
ans = [](1x0x4x2)
All of these are consistent with Matlab.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61690>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, (continued)
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Nicholas Jankowski, 2022/04/04
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Sarrah Bastawala, 2022/04/04
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Sarrah Bastawala, 2022/04/04
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Nicholas Jankowski, 2022/04/04
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Nicholas Jankowski, 2022/04/04
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, John W. Eaton, 2022/04/05
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Sarrah Bastawala, 2022/04/05
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Nicholas Jankowski, 2022/04/05
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Sarrah Bastawala, 2022/04/05
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Nicholas Jankowski, 2022/04/05
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs,
Sarrah Bastawala <=
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Sarrah Bastawala, 2022/04/13
- [Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs, Sarrah Bastawala, 2022/04/16