bugGNU Octave - Bugs: bug #55659, s_idx output of ismember uses last...

 
 

bug #55659: s_idx output of ismember uses last occurrence when there are duplicates, Matlab uses first

Submitted by:  Travis Arnold <teerav42>
Submitted on:  Wed 06 Feb 2019 08:50:15 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  2 Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 06 Feb 2019 09:25:04 PM UTC, comment #1:

It looks like the documentation author may have intended to swap 's' and 'a'

In any case, this was an easy fix which I made here (https://hg.savannah.gnu.org/hgweb/octave/rev/c17bdf3b3841).

Whether the first, or last, index is returned when there are multiple occurrences in the set is a small thing. The index is only meant to be used with the original set and either convention will work just fine.

I'm changing the priority to low, but if you make a changeset for this issue report it can be applied.

Rik <rik5>
Project Administrator
Wed 06 Feb 2019 08:50:15 PM UTC, original submission:

The Octave documentation for ismember gives the following example:

In reality, in Octave this returns

This is consistent with Matlab, so the documentation should be updated to reflect the actual behavior.

However, here is an example where the behavior of ismember is inconsistent with Matlab:

In Octave this returns

In Matlab it returns

The Matlab documentation for ismember notes that its behavior has changed (though it doesn't say as of which release), noting that "occurrence of indices in s_idx switched from highest to lowest".

This will be a straightforward fix I would imagine, and I might be able to do it myself at some point given that ismember is not a compiled function, but I do not have time for it at the moment and might not for a while.

Travis Arnold <teerav42>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by teerav42 (Submitted the item)
  • -email is unavailable- added by teerav42
  •  

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

    Only project members can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-06 rik5 Priority5 - Normal => 2
        StatusNone => Confirmed
        Release4.4.1 => dev
        Summaryismember documentation is misleading, and behavior is incompatible with Matlab => s_idx output of ismember uses last occurrence when there are duplicates, Matlab uses first
    2019-02-06 teerav42 Carbon-Copy- => Added -email is unavailable-

    Back to the top


    Powered by Savane 3.4