bugGNU Octave - Bugs: bug #47287, accumarray unable to handle empty...

 
 

bug #47287: accumarray unable to handle empty list of subscripts

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Sat 27 Feb 2016 06:23:12 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 05 Mar 2016 01:33:06 AM UTC, comment #2:

I have pushed the following 2 commits:

http://hg.savannah.gnu.org/hgweb/octave/rev/2f402f7c1a0b

http://hg.savannah.gnu.org/hgweb/octave/rev/8cfc50637511

I'm not super happy with the first one, as I don't think it handles with the issue elegantly and adds a special case for n == 0. Still, it fixes the issue.

Carnë Draug <carandraug>
Project Member
Sun 28 Feb 2016 06:39:25 PM UTC, comment #1:

I have attached a file that fixes this issue. It has two csets, fixing two different bug related bugs.

I found that this was not an issue for the special cases of sum, max, and min because they use a special code path. I still added test cases for them to avoid regressions in the future.

I don't really like the fix. I couldn't find an elegant way to do it, and had to resort to a "n != 0". If anyone has a better plan that would be great.

The second cset fixes a related issue which is being able to automatically find the output size when list of subscript is empty.

This whole thing introduce a Matlab incompatibility though (I guess it could be considered a Matlab bug). It was not on purpose but came out as a side effect of fixing the support for empty SUBS.

When FUNC returns a cell element, and SUBS is empty, we are now returning a cell array (previously we would error). This makes sense to me, FUNC is meant to create a cell array. Matlab seems to always return an array of doubles. However, we still only do this for the general case of '@(x) {x}'.

(file #36499)

Carnë Draug <carandraug>
Project Member
Sat 27 Feb 2016 06:23:12 PM UTC, original submission:

accumarray() does not handle an empty list of subscripts. Example:

I would expect to get back an empty matrix.

Carnë Draug <carandraug>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #36499:  accumarray-zero-length-dims.cset added by carandraug (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by carandraug (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 05 Mar 2016 01:33:06 AM UTCcarandraugStatusNone=>Fixed
      Open/ClosedOpen=>Closed
      Release4.0.0=>dev
    Sun 28 Feb 2016 06:39:25 PM UTCcarandraugAttached File-=>Added accumarray-zero-length-dims.cset, #36499

    Back to the top


    Powered by Savane 3.1-cleanup1