patchGNU Octave - Patches: patch #10440, Allow unique to process cellstr...

 
 

patch #10440: Allow unique to process cellstr arrays with the 'rows' option

Submitter:  Andreas Bertsatos <pr0m1th3as>
Submitted:  Sun 17 Mar 2024 01:48:11 AM UTC
   
 
Category:  Core : new feature Priority:  5 - Normal
Status:  Need Info Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 14 Oct 2024 04:11:20 PM UTC, comment #4: 

updated patch applies cleanly to current default tip and adds a NEWS message.  BIST ordering/locations was only significant change from last patch.

I can't imagine a good case for anyone else relying on the prior

unique({cellstring}, "rows") ==> unique({cellstring})

behavior. But this behavior along with a warning is the current Octave and Matlab behavior.  Will still await any other input on whether to add this.

(file #56529)

Nicholas Jankowski <nrjank>
Group Member
Mon 14 Oct 2024 03:33:00 PM UTC, comment #3: 

I think we were waiting on concurrence regarding adding the new option and if there is any potential compatibility concern.

there were other recent changes to unique.m, so the patch probably has to be recast against the current state. 

I can give that a quick peek.  changing to Need Info.

Nicholas Jankowski <nrjank>
Group Member
Sun 13 Oct 2024 07:12:21 PM UTC, comment #2: 

This has been "In progress" for over half a year. What needs to be done to get this patch report finished?

Philip Nienhuis <philipnienhuis>
Group Member
Sun 17 Mar 2024 11:43:46 PM UTC, comment #1: 

here's a modified patch which will apply cleanly to the current default branch. 

this seems like a worthwhile extension to unique.  I wasn't able to break it or cause any other problems after the change.

There will be a potential compatibility issue, as currently for a cellstring array A, unique(A,'rows') returns the same as unique(A). Matlab is also pretty explicit in it's help for unique that 'rows' does not work for cell arrays. Does anyone know if there are particular problems supporting cellstrings would cause?

running the test suite now to see if it triggers any other issues, but don't expect any.

(file #55857)

Nicholas Jankowski <nrjank>
Group Member
Sun 17 Mar 2024 01:48:11 AM UTC, original submission:  

I have modified the unique function to handle cellstr arrays with the rows option. The modified function (see attachment) includes two extra BISTs for the new functionality and a minor adjustment in the documentation regarding the “rows” option. I have attached a patch file 'unique.diff'.

This is an Octave extension, since MATLAB does not support this functionality. Another issue about MATLAB's unique implementation is that it does not allow a combination of 'sorted'/'stable' and 'first'/'last' options. Octave behaves the same. As a result, if we opt for 'first'/'last', these are always computed with 'sorted' by default, which is a bit annoying since there are cases that some extra flexibility would be very useful. Are we interested in obtaining this extra functionality? If so, I could work on this and submit another patch.

Andreas Bertsatos <pr0m1th3as>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #56529:  unique_cellstr_rows_patch10440_v2.patch added by nrjank (4KiB - application/octet-stream - updated patch against default (hg id c29969c6b6ac))
file #55857:  unique_cellstr_rows_patch10440.patch added by nrjank (3KiB - application/octet-stream - patch against default (hg id ce6d586e18c4))
file #55848:  unique.diff added by pr0m1th3as (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by pr0m1th3as (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-10-14 nrjank Attached File- Added unique_cellstr_rows_patch10440_v2.patch, #56529
    2024-10-14 nrjank StatusIn Progress Need Info
    2024-03-17 nrjank Attached File- Added unique_cellstr_rows_patch10440.patch, #55857
        StatusNone In Progress
    2024-03-17 pr0m1th3as Attached File- Added unique.diff, #55848

    Back to the top

    Powered by Savane 3.14-25bf.
    Corresponding source code