[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs
From: |
Carlo de Falco |
Subject: |
[Octave-bug-tracker] [bug #61690] Behavior of sum() with empty inputs |
Date: |
Wed, 22 Jun 2022 08:57:01 -0400 (EDT) |
Follow-up Comment #16, bug #61690 (project octave):
The changeset now does apply cleanly.
Apart from fixing the coding style, could you please
explain better what the cangeset does and why?
The relevant part of the code appears to be this
--- a/liboctave/operators/mx-inlines.cc Tue May 31 23:34:23 2022 -0400
+++ b/liboctave/operators/mx-inlines.cc Wed Jun 01 18:59:30 2022 +0530
@@ -1542,8 +1542,15 @@
octave_idx_type l, n, u;
dim_vector dims = src.dims ();
// M*b inconsistency: sum ([]) = 0 etc.
- if (dims.ndims () == 2 && dims(0) == 0 && dims(1) == 0)
- dims(1) = 1;
+ if(dims.zero_by_zero () )
+ {
+ if(dim!=-1)
+ {
+ dims(dim) = 1;
+ }
+ else
+ dims(1) = 1;
+ }
can you comment on it a bit?
BTW the correct formatting would be :
if (dims.zero_by_zero ())
{
if (dim != -1)
dims(dim) = 1;
else
dims(1) = 1;
}
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61690>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/