bugGNU Octave - Bugs: bug #44071, ismember fails with unsorted...

 
 

bug #44071: ismember fails with unsorted complex set

Submitted by:  None
Submitted on:  Fri 23 Jan 2015 01:33:28 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Henry ShuOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.8.1
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 26 Jan 2015 11:35:19 PM UTC, comment #4:

There was a cut and paste error in Array-C.cc where instead of comparing x and y, x and x were compared.

This has been fixed on the development branch in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/884e0c55d92c). The reporter will need to build from Mercurial sources in order to see the fix.

Rik <rik5>
Project Administrator
Fri 23 Jan 2015 09:52:23 AM UTC, comment #3:

Matlab r2015a prerelease on Windows:

Matlab cannot load the mat file directly:

...so I had to first load the .mat file in Octave and write it as -v7 .mat file.

(@Carlo: I didn't see a variable "ii" in Octave.)

Anyway, Matlab gives:

It could be that Matlab casts A into a complex type before attempting ismember() s.s.
IMO that seems the logical thing to do.

(OS -> Any; status -> confirmed)

Philip Nienhuis <philipnienhuis>
Project Member
Fri 23 Jan 2015 08:11:27 AM UTC, comment #2:

the values stored in the attached file
are complex.

If using only the real part of 's' ismember works as you
would expect:

Checking for a complex zero, i.e. 0+i0 also works:

I don't know whether it would be correct
for ismember to report true when looking for
a zero of type double in an array of type
complex.

Does anyone know what Matlab does in this case?

Carlo de Falco <cdf>
Project Member
Fri 23 Jan 2015 04:49:20 AM UTC, comment #1:

Thanks for your bug report. The failure occurs because the column vector s is not sorted and because issorted(s) returns true. The ismember function relies on these functions to behave consistently for the provided set. So the fix maybe should resolve issorted for complex inputs.

Mike Miller <mtmiller>
Project Administrator
Fri 23 Jan 2015 01:33:28 AM UTC, original submission:

Please load ismember_bug.mat attached

A is a scalar double of value 0.
s is a column vector of 299 double values containing at least one 0.
However, ismember failed to recognize the membership of A in s.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32901:  ismember_bug.mat added by None (5KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 26 Jan 2015 11:35:19 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 23 Jan 2015 09:52:23 AM UTCphilipnienhuisStatusNeed Info=>Confirmed
      Operating SystemGNU/Linux=>Any
    Fri 23 Jan 2015 08:11:53 AM UTCcdfStatusConfirmed=>Need Info
    Fri 23 Jan 2015 04:49:20 AM UTCmtmillerItem GroupNone=>Incorrect Result
      StatusNone=>Confirmed
      Summaryismember fails to recognize set membership=>ismember fails with unsorted complex set
    Fri 23 Jan 2015 01:33:28 AM UTCNoneAttached File-=>Added ismember_bug.mat, #32901

    Back to the top


    Powered by Savane 3.1-cleanup1