bugGNU Octave - Bugs: bug #36099, diag(1,N,M) produces NaNs

 
 

bug #36099: diag(1,N,M) produces NaNs

Submitted by:  None
Submitted on:  Thu 05 Apr 2012 12:25:50 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: Jordi GutiĆ©rrez Hermoso <jordigh>
Originator Name: Twan van LaarhovenOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.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.

 

Tue 17 Apr 2012 03:56:59 PM UTC, comment #4:

I also checked in the following change on the stable branch so that filling will work correctly for three-arg diag function calls with cell array arguments:

http://hg.savannah.gnu.org/hgweb/octave/rev/5bb5fcffa29d

You will still have to wait for 3.8.0 to get the fixes to make diag actually return diagonal matrix objects for real and complex values in the three-arg case. But I think 3.6.2 will at least return correctly formed full matrix objects.

John W. Eaton <jwe>
Project Administrator
Thu 12 Apr 2012 08:29:46 PM UTC, comment #3:

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/e8e86ae3abbc

This fix will appear in Octave 3.8.0.

John W. Eaton <jwe>
Project Administrator
Thu 05 Apr 2012 06:14:52 PM UTC, comment #2:

This is a duplicate of bug #35946.

However, you've pointed out something else I hadn't noticed. It's not returning a diagonal matrix type. It seems the problem goes deeper than I had thought. I'm investigating it now.

Jordi GutiƩrrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Thu 05 Apr 2012 02:16:23 PM UTC, comment #1:

Probable cause seems to be:
+verbose+
return Array<ST> (dim_vector (1, 1), scalar).diag (k);
-verbose-
The diag() function of Array produces a dense matrix instead of DiagMatrix object. I think an MArray<ST> should be used instead.

That would also fix the issue that a dense matrix is produced, while it shouldn't be:
+verbose+
octave:1> length(diag([1,2],1e5,1e5))
ans = 100000
octave:2> length(diag([1],1e5,1e5))
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
-verbose-

This doesn't explain why Array::diag or Array::resize messes things up, though.

Twan van Laarhoven <twanvl>
Thu 05 Apr 2012 12:25:50 PM UTC, original submission:

Expected result is

On a slightly related note: diag(1,3,3)(1,2)=1.0556e-316, instead of exactly 0.

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 jwe (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by twanvl (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 12 Apr 2012 08:29:46 PM UTCjweStatusDuplicate=>Fixed
      Open/ClosedOpen=>Closed
    Thu 05 Apr 2012 06:14:52 PM UTCjordighStatusNone=>Duplicate
      Assigned toNone=>jordigh

    Back to the top


    Powered by Savane 3.1-cleanup1