bugGNU Octave - Bugs: bug #57671, Power operator operating on...

 
 

bug #57671: Power operator operating on complex numbers results in NaN when broadcasting

Submitter:  None
Submitted:  Sun 26 Jan 2020 11:18:40 PM UTC
   
 
Category:  Interpreter Severity:  4 - Important
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  gs Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 27 Jan 2020 01:35:49 AM UTC, comment #2: 

Bumping the version up to "dev" since this is still present.  The issue seems to be related to broadcasting and I have changed the Summary to reflect that.

A simple test case with broadcasting that fails is


([1;0]*j) .^ [1, 0]
ans =

   0.0000 + 1.0000i   1.0000 +      0i
        0 +      0i      NaN -    NaNi


But if the matrices are full and there is no broadcasting then this works


([1,1; 0,0]*j) .^ [1, 0; 1, 0]
ans =

   0 + 1i   1 + 0i
   0 + 0i   1 + 0i



Rik <rik5>
Group administrator
Mon 27 Jan 2020 12:08:09 AM UTC, comment #1: 

I tried on 5.2.0

> (j*[0;0]).^[2 1 0]

ans =

   0   0   1
   0   0   1

>> (j*[0;0;0]).^[2 1 0]

ans =

   0   0   1
   0   0   1
   0   0   1

>> (j*[0;1;0]).^[2 1 0]

ans =

   0.00000 + 0.00000i   0.00000 + 0.00000i       NaN -     NaNi
  -1.00000 + 0.00000i   0.00000 + 1.00000i   1.00000 + 0.00000i
   0.00000 + 0.00000i   0.00000 + 0.00000i       NaN -     NaNi

>>

Doug Stewart <dastew>
Sun 26 Jan 2020 11:18:40 PM UTC, original submission:  

j is the complex operator

note the NaN in the last one




>> (j*[0]).^[2 1 0]


ans =

   0   0   1

>> (j*[1]).^[2 1 0]


ans =

  -1 + 0i   0 + 1i   1 + 0i

>> (j*[0;1]).^[2 1 0]


ans =

   0.00000 + 0.00000i   0.00000 + 0.00000i       NaN -     NaNi
  -1.00000 + 0.00000i   0.00000 + 1.00000i   1.00000 + 0.00000i

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-27 rik5 CategoryNone Interpreter
        Severity3 - Normal 4 - Important
        Item GroupNone Incorrect Result
        StatusNone Confirmed
        Release4.2.2 dev
        SummaryComplex numbers in array gives NaN Power operator operating on complex numbers results in NaN when broadcasting

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code