bugGNU Octave - Bugs: bug #40743, num2str fails to handle sparse...

 
 

bug #40743: num2str fails to handle sparse matrix with mixed Inf/NaN

Submitter:  Michael Goffioul <goffioul>
Submitted:  Fri 29 Nov 2013 02:31:54 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Dec 2013 10:18:38 PM UTC, comment #2: 

I checked in a fix for max/min that returns a null sparse matrix when one of the inputs is null (http://hg.savannah.gnu.org/hgweb/octave/rev/35464baa7d99).  With that in place, num2str now works correctly on the example in this bug report.

Rik <rik5>
Group administrator
Mon 02 Dec 2013 05:35:14 PM UTC, comment #1: 

I think the failure is in the max() operator for sparse matrices.  It should not bother to check the dimensions of null matrices.

Some sample code:


## Works with Full matrices
max (zeros (1,0), ones (1,1))
ans = [](1x0)
## Fails with Sparse matrices
max (sparse(zeros (1,0)), sparse(ones (1,1)))
error: max: matrix size mismatch
## Works partially with mixed full/sparse matrices
max (sparse(zeros (1,0)), ones (1,1))
ans = Compressed Column Sparse (rows = 1, cols = 0, nnz = 0)
max (zeros (1,0), sparse(ones (1,1)))
error: max: nonconformant arguments (op1 is 1x0, op2 is 1x1)


Rik <rik5>
Group administrator
Fri 29 Nov 2013 02:31:54 AM UTC, original submission:  

The following fails in Linux and Windows (@ afeb233ea443):


octave-cli:5> num2str(sparse([complex(Inf, NaN)]))
error: max: matrix size mismatch
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   /home/goffioul/Sources/Others/octave-hg/build-linux/../scripts/general/num2str.m at line 132, column 11


Michael Goffioul <goffioul>

 

(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 rik5 (Posted a comment)
  •  

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

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-12-04 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2013-12-02 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code