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

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

[Octave-bug-tracker] [bug #52365] Octave crashes when solving a sparse s


From: Rik
Subject: [Octave-bug-tracker] [bug #52365] Octave crashes when solving a sparse system of linear equations (U = K \ R)
Date: Mon, 13 Nov 2017 20:44:43 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #52365 (project octave):

                  Status:               Confirmed => In Progress            

    _______________________________________________________

Follow-up Comment #6:

The problem seems to be very subtle.  The  xtype and data pointer for the B
matrix are set by this code.


          B->xtype = CHOLMOD_REAL;

          if (b.rows () < 1 || b.cols () < 1)
            B->x = &dummy;
          else
            B->x = b.data ();


Later on within the SuiteSparse library there is an if test on this codition


    ((A)->xtype != CHOLMOD_PATTERN && ((A)->x) == NULL) || \


The problem occurs when the Sparse matrix is empty.  In this case, because
there is no data to store, the data pointer is NULL.  That causes SuiteSparse
to eventually fail.  Apparently this problem has been encountered before.  The
test for rows or columns less than one looks like it is designed to find empty
matrices, and replace the nullptr with a dummy pointer to a valid region.

I replaced the code above with 



 B->x = b.data ();
 if (B->x == 0x0)
   B->x = &dummy;


This works and the code no longer segfaults.  The question is whether this is
okay in all situations.  I think it is, but I'm adding jwe to the CC list so
he can comment on this change.

If it is okay, it should be implemented in 4 different instances in dSparse.cc
and 4 more in CSparse.cc on the stable branch.  On the default branch, the
comparison to 0x0 should be replaced with a comparison to nullptr.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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