[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: |
Sat, 18 Nov 2017 13:24:06 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 |
Follow-up Comment #4, bug #52437 (project octave):
A possible patch to the reimplemented version is to add something like this at
the beginning:
if (isnumeric(a)&&~isreal(a)) || (isnumeric(s)&&~isreal(s))
[~, ~, u] = unique([a(:); s(:)]);
a(:) = real(u(1:numel(a)));
s(:) = real(u(numel(s)+1:end));
end
That is, if complex inputs are detected, replace values in the inputs by
globally unique integer labels. By "globally unique" I mean unique across the
two inputs. That way the lookup function will work fine.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52437>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/