bugGNU Octave - Bugs: bug #47951, find complex number array elements...

 
 

bug #47951: find complex number array elements with condition

Submitted by:  None
Submitted on:  Wed 18 May 2016 03:03:30 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Wont FixAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.2
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 18 May 2016 03:14:24 AM UTC, comment #1:

Thanks for the bug report. This is a documented incompatibility with Matlab. There are few intentional incompatibilities, but this is one of them.

From the manual section "Comparison Operators"

For complex numbers, the following ordering is defined: z1 < z2 if and only if

abs (z1) < abs (z2)
|| (abs (z1) == abs (z2) && arg (z1) < arg (z2))

This is consistent with the ordering used by max, min and sort, but is not consistent with MATLAB, which only compares the real parts.

https://www.gnu.org/software/octave/doc/interpreter/Comparison-Ops.html

So complex(-1,0) is not less than zero intentionally.

Mike Miller <mtmiller>
Project Administrator
Wed 18 May 2016 03:03:30 AM UTC, original submission:

Hi,

Finding elements with a condition from an array with complex numbers works differently between matlab and octave.

Here's an example

Octave returns all elements but 0.

However, matlab doesn't include last two items in the result. It only returns 1, 2+1i, 3.

The following code returns same result in both

Regards,
Louis

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 18 May 2016 03:14:24 AM UTCmtmillerStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1