bugGNU Octave - Bugs: bug #40305, real (sparse (2i)) creates bad...

 
 

bug #40305: real (sparse (2i)) creates bad internally formatted sparse matrix

Submitted by:  Rik <rik5>
Submitted on:  Fri 18 Oct 2013 05:48:45 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: David Bateman <dbateman>
Originator Name: Open/Closed: Closed
Release: devOperating 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 18 Oct 2013 10:48:37 PM UTC, comment #2:

I backed the temporary fix out 12 minutes after you checked in your fix.

Rik <rik5>
Project Administrator
Fri 18 Oct 2013 09:18:28 PM UTC, comment #1:

I'm surprised this bug was there since at least 2005 without being seen and fixed as the fix is trivial. See the changeset

http://hg.savannah.gnu.org/hgweb/octave/rev/8031fc73f291

Rik, should you backout the changeset 1d41b1910531 as casting a sparse matrix as full isn't really that great an idea as the memory requirement and performance might be significantly degraded.

David

David Bateman <dbateman>
Project MemberIn charge of this item.
Fri 18 Oct 2013 05:48:45 PM UTC, original submission:

I just tracked down a segfault in Octave to incorrect behavior of real() for sparse matrices.

Check out the following:

debug> x = sparse (2i)
x = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

(1, 1) -> 0 + 2i
debug> typeinfo (x)
ans = sparse complex matrix
debug> xr = real (x)
xr = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

(1, 1) -> 0
debug> typeinfo (xr)
ans = sparse matrix
debug> nnz (xr)
ans = 1

The problem is that the internal format seems to have become corrupted after the call to real which changed a non-zero entry to a zero entry. nnz() should return 0 after the call to real().

If you try to use this bad matrix in further calculations it can lead to a segfault. Example:

Rik <rik5>
Project Administrator

 

(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 dbateman (Posted a comment)
  • -unavailable- added by rik5 (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 18 Oct 2013 09:18:28 PM UTCdbatemanStatusNone=>Fixed
      Assigned toNone=>dbateman
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1