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

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

[Octave-bug-tracker] [bug #55659] ismember documentation is misleading,


From: Travis Arnold
Subject: [Octave-bug-tracker] [bug #55659] ismember documentation is misleading, and behavior is incompatible with Matlab
Date: Wed, 6 Feb 2019 15:50:17 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

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

                 Summary: ismember documentation is misleading, and behavior
is incompatible with Matlab
                 Project: GNU Octave
            Submitted by: teerav42
            Submitted on: Wed 06 Feb 2019 08:50:15 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

The Octave documentation for ismember gives the following example:


a = {"abc"};
s = {"abc", "def"};
[tf, s_idx] = ismember (a, s)
=> tf = [1, 0]
=> s_idx = [1, 0]


In reality, in Octave this returns


=> tf = 1
=> s_idx = 1


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:


a = {'abc'};
s = {'abc', 'def', 'abc'};
[tf, s_idx] = ismember(a, s)


In Octave this returns


=> tf = 1
=> s_idx = 3


In Matlab it returns


=> tf = 1
=> s_idx = 1


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.




    _______________________________________________________

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]