bugGNU Octave - Bugs: bug #30521, Error in diag function for complex...

 
 

bug #30521: Error in diag function for complex numbers

Submitted by:  Jaime Ferrer <ferrer>
Submitted on:  Thu 22 Jul 2010 04:12:25 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Jaroslav Hajek <highegg>
Originator Name: Open/Closed: Closed
Release: 3.2.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 23 Jul 2010 06:38:10 AM UTC, comment #2:

The first part actually uncovers another bug and only because of that it seems to work. I've fixed both of these.
http://hg.savannah.gnu.org/hgweb/octave/rev/83896a06adaf
http://hg.savannah.gnu.org/hgweb/octave/rev/7fa044155982

thanks for reporting.

Jaroslav Hajek <highegg>In charge of this item.
Fri 23 Jul 2010 01:05:57 AM UTC, comment #1:

The behavior is slightly better in the development version of Octave (3.3.51) in that the first two parts work. However, the third step is still broken.

m1 = [0.1+2i]
m2 = diag(m1)
m3 = diag(m2)

typeinfo(m1)
typeinfo(m2)
typeinfo(m3)
-------------------------
Results
m1 = 0.1000 + 2.0000i
m2 = 0.10000 + 2.00000i
m3 = 0.10000

ans = complex matrix
ans = complex scalar
ans = scalar

From the documentation, diag is designed to work on a vector to produce a matrix or on a matrix to produce a vector. I'm guessing that there's no test to see if the input is "complex scalar" and handle that case. At least for a scalar input, it returns a scalar output and that should probably be the default for complex inputs as well.

Rik <rik5>
Project Administrator
Thu 22 Jul 2010 04:12:25 PM UTC, original submission:

If you use diag to convert a complex vector to a diagonal complex matrix, the function crashes if the vector has dim=1
Example:
g=[0.1+2i]
h=diag(g)
hh=diag(h)

Result:
g = 0.10000 + 2.00000i
h = 0.10000
hh = 0.10000

Jaime Ferrer <ferrer>

 

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

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

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 23 Jul 2010 06:38:10 AM UTChigheggStatusConfirmed=>Fixed
      Assigned toNone=>highegg
      Open/ClosedOpen=>Closed
    Fri 23 Jul 2010 01:05:57 AM UTCrik5StatusNone=>Confirmed
    Thu 22 Jul 2010 04:12:25 PM UTCferrerCarbon-Copy-=>Added ferrer

    Back to the top


    Powered by Savane 3.1-cleanup1