octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #40305] real (sparse (2i)) creates bad interna


From: Rik
Subject: [Octave-bug-tracker] [bug #40305] real (sparse (2i)) creates bad internally formatted sparse matrix
Date: Fri, 18 Oct 2013 17:48:46 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0

URL:
  <http://savannah.gnu.org/bugs/?40305>

                 Summary: real  (sparse (2i)) creates bad internally formatted
sparse matrix
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Fri 18 Oct 2013 10:48:45 AM PDT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Crash
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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))






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40305>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]