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

 
 

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

Submitter:  Rik <rik5>
Submitted:  Fri 18 Oct 2013 05:48:45 PM UTC
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  dbateman
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

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 Member
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:

complex (xr, sparse (1))

Rik <rik5>
Project Administrator

 

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

    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 project members can vote.

     

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-18 dbateman StatusNone Fixed
        Assigned toNone dbateman
        Open/ClosedOpen Closed

    Back to the top


    Powered by Savane 3.9