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

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

[Octave-bug-tracker] [bug #52437] Second output of ismember is wrong for


From: Luis Mendo
Subject: [Octave-bug-tracker] [bug #52437] Second output of ismember is wrong for complex input
Date: Fri, 17 Nov 2017 17:43:58 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?52437>

                 Summary: Second output of ismember is wrong for complex input
                 Project: GNU Octave
            Submitted by: lmendo
            Submitted on: Fri 17 Nov 2017 10:43:57 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Luis Mendo
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0
        Operating System: Any

    _______________________________________________________

Details:

This code


x = [5 4-3j 3+4j]; [~, b] = ismember(x, x)


gives [3 3 3] instead of the expected [1 2 3].

The problem seems to be that 'ismember' uses the 'lookup' function, which was


## Reimplemented using lookup & unique: Jaroslav Hajek <address@hidden>


and 'lookup' has the comment


// In the case of a complex array, absolute values will be used for
// compatibility (though it's not too meaningful).


Well, it may not be meaningful for lookup's original purpose, but it
definitely is for ismember.

It looks like ismember's second output should be obtained with something other
than lookup, at least in the complex case




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52437>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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