bugGNU Octave - Bugs: bug #52431, perms fails for cell arrays and...

 
 

bug #52431: perms fails for cell arrays and structs

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Fri 17 Nov 2017 03:39:25 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
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.

 

Fri 17 Nov 2017 06:47:17 PM UTC, comment #4:

I pushed your change and split the tests in a separate changeset.

Thanks.

John W. Eaton <jwe>
Project Administrator
Fri 17 Nov 2017 06:05:32 PM UTC, comment #3:

Apologies for the duplicated effort. I should have mentioned that I was also working on a patch. It fixes another issue which is that value of elements is not used when computing permutations of logical input.

The attached patch adds more tests, only tries to sort when input is numeric of char (use of sort is the root of this bug). It also sorts them by ascending order and only reverts in the n>4 case.

(file #42417)

Carnë Draug <carandraug>
Project Member
Fri 17 Nov 2017 05:45:49 PM UTC, comment #2:

For non-numeric objects, could we just use something like

Proposed patch attached.

I also split the new tests into individual assertions to make debugging easier.

(file #42416)

John W. Eaton <jwe>
Project Administrator
Fri 17 Nov 2017 04:04:22 PM UTC, comment #1:

I have added tests for this with http://hg.savannah.gnu.org/hgweb/octave/rev/ba51a6fd6a18 with results compatible with Matlab R2016b

This worked fine on previous versions of Octave, it was just the order that was not matlab compatible.

Carnë Draug <carandraug>
Project Member
Fri 17 Nov 2017 03:39:25 PM UTC, original submission:

perms should be able to list permutations of the elements in a cell array or struct. However, since cset b7da08507fae , which was meant to fix bug #50426 , it no longer works.

Removing the check for numeric type does not fix it, since the rewritten function now makes use of sort.

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 #42417:  fix-perms.cset added by carandraug (3KiB - application/octet-stream)
file #42416:  diffs.txt added by jwe (2KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -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
    Fri 17 Nov 2017 06:47:17 PM UTCjweStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 17 Nov 2017 06:05:32 PM UTCcarandraugAttached File-=>Added fix-perms.cset, #42417
    Fri 17 Nov 2017 05:45:49 PM UTCjweAttached File-=>Added diffs.txt, #42416

    Back to the top


    Powered by Savane 3.1-cleanup1