octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55659] s_idx output of ismember uses last occ


From: Rik
Subject: [Octave-bug-tracker] [bug #55659] s_idx output of ismember uses last occurrence when there are duplicates, Matlab uses first
Date: Wed, 6 Feb 2019 16:25:04 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #55659 (project octave):

                Priority:              5 - Normal => 2                      
                  Status:                    None => Confirmed              
                 Release:                   4.4.1 => dev                    
                 Summary: ismember documentation is misleading, and behavior
is incompatible with Matlab => s_idx output of ismember uses last occurrence
when there are duplicates, Matlab uses first

    _______________________________________________________

Follow-up Comment #1:

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


[tf, s_idx] = ismember (s, a)
=> tf = [1, 0]
=> s_idx = [1, 0]


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.


s(s_idx_first_duplicate) == s(s_idx_last_duplicate) == a


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


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55659>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]