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

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

[Octave-bug-tracker] [bug #56232] Octave crash when inverting an empty s


From: Rik
Subject: [Octave-bug-tracker] [bug #56232] Octave crash when inverting an empty sparse matrix.
Date: Tue, 7 May 2019 17:56:53 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #29, bug #56232 (project octave):

@jwe: This was the approach I was trying to avoid since it requires three
changes instead of one, and the overhead of managing small blocks on the heap
(https://stackoverflow.com/questions/1087042/c-new-int0-will-it-allocate-memory).

But, if it will make the implementation of the mex interface simpler we could
do it.  Since Matlab's documentation is often only loosely coupled to its
behavior, we should verify with a sample mex program, that mxGetJc really does
return a valid pointer for an empty sparse array.

Attached is a patch that modifies the sparse constructors, but uses C++11
aggregate value initialization '{}' in the mem-init rather than writing a
constructor to which uses std::fill_n.  It makes for shorter code without, I
think, any loss of clarity.

Regardless, with either patch applied, I get


error: inv: division by zero
error: called from
    tst_inv at line 3 column 1


when trying to take the inverse of an empty matrix.


(file #46879)
    _______________________________________________________

Additional Item Attachment:

File name: sparse_constructor.diffs       Size:1 KB
    <https://savannah.gnu.org/file/sparse_constructor.diffs?file_id=46879>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56232>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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