bugGNU Octave - Bugs: bug #34655, max(z,0) where z is a complex...

 
 

bug #34655: max(z,0) where z is a complex vector is incorrect

Submitted by:  Alan E. Schoen <aeschoen>
Submitted on:  Tue 25 Oct 2011 08:58:46 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: aeschoenOpen/Closed: Closed
Release: 3.2.4Operating System: Microsoft Windows

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 25 Oct 2011 11:55:37 PM UTC, comment #3:

The documentation string for max () explains what is being calculated. Try 'help max'. Quoting from the documentation "For complex arguments, the magnitude of the elements are used for comparison."

In this case, the magnitude, i.e., length in the plane are all greater than zero and so each value, including complex numbers with negative real parts, are returned.

Matlab behaves the same way (http://www.mathworks.com/help/techdoc/ref/max.html). I think you need to modify the script in question to have it do what you want.

Rik <rik5>
Project Administrator
Tue 25 Oct 2011 11:29:00 PM UTC, comment #2:

z=[1.0+1.0i,-1.0+1.0i,1.0+1.0i]
x=max(z,0)

this should result in x being 1.0+1.0i,0.0+0.0i,1.0+1.0i
however, the negative second element persists

y=max(real(z),0) works as expected i.e. 1,0,1

Alan E. Schoen <aeschoen>
Tue 25 Oct 2011 11:00:29 PM UTC, comment #1:

Please provide a specific small example that shows the problem, including the output you expect to see.

John W. Eaton <jwe>
Project Administrator
Tue 25 Oct 2011 08:58:46 PM UTC, original submission:

In the windows distribution 3.2.4, a matlab script that includes max(z,0) where z is the result of an fft and therefore a complex vector does not function. the intent is to clip the vector to positive values, but negative values persist unchanged. This behavior differs from matlab where this works.

Alan E. Schoen <aeschoen>

 

(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 rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by aeschoen (Submitted the item)
  • -unavailable- added by aeschoen
  •  

    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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 25 Oct 2011 11:55:37 PM UTCrik5StatusNeed Info=>Invalid
      Open/ClosedOpen=>Closed
    Tue 25 Oct 2011 11:00:29 PM UTCjweStatusNone=>Need Info
    Tue 25 Oct 2011 08:58:46 PM UTCaeschoenCarbon-Copy-=>Added aeschoen

    Back to the top


    Powered by Savane 3.1-cleanup1