bugGNU Octave - Bugs: bug #38414, Unhelpful error message when...

 
 

bug #38414: Unhelpful error message when loading an invalid sparse matrix

Submitter:  None
Submitted:  Tue 26 Feb 2013 06:16:50 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  3 - Low Item Group:  Other
Status:  Fixed Assigned to:  lachlan
Originator Name:  Michael Ekstrand Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 16 May 2016 04:01:12 AM UTC, comment #7: 

I went ahead and changed the cset to use 1-based indexing for the elements and checked it in here (http://hg.savannah.gnu.org/hgweb/octave/rev/ac59b72712fd).

I'm trying to reduce the backlog of patches you have submitted :)

Rik <rik5>
Group administrator
Sat 14 May 2016 06:01:34 PM UTC, comment #6: 

This seems like a relatively small and useful change.  One question, would it not be better to number the elements from 1 (natural language first element) rather than 0 (C-style array)?

Octave's own matrices have 1,1 as their first element, not 0.

Rik <rik5>
Group administrator
Fri 29 Apr 2016 01:53:20 AM UTC, comment #5: 

For the attached file "a", the command "load a" gives the problem with a recent default build.

For me, having 1e+05 in column 1 gives


error: load: invalid sparse matrix: column index = 0 out of range


and having 1e+05 in column 2 gives


error: load: failed to load matrix constant


while having 1e+05 in column 3 gives no error since it isn't an index column

(file #37017)

Lachlan Andrew <lachlan>
Fri 29 Apr 2016 01:08:18 AM UTC, comment #4: 

Is there an example (bad!) data file that can be used to check the patch works as intended?  I tried to manually edit a simple sparse matrix saved in the text file to change one of the columns to 1e+05 but I can't reproduce the original error.

Rik <rik5>
Group administrator
Fri 26 Feb 2016 09:27:47 AM UTC, comment #3: 

The attached patch gives clearer error messages.  It lists the element number at which the error occurs, and if an index fails to lead as an integer, it prints the offending value as a string.

This patch also moves load_sparse_matrix into Sparse.cc from Sparse.h.

(file #36468)

Lachlan Andrew <lachlan>
Thu 25 Feb 2016 10:01:23 PM UTC, comment #2: 

I assume by "inadvertently", the original poster was suggesting that this file was created outside of Octave.

Nevertheless, 1e+05 is mathematically an integer.  Would there be value in reading the indices as doubles and explicitly checking for integrality?

Separately from that, if an error is detected, it would be nice to say where in the file it occurs, and what the offending field contained.  I'll add that to my to-do list.

Lachlan Andrew <lachlan>
Sat 20 Apr 2013 12:16:01 AM UTC, comment #1: 

Confirmed; the rows and columns fields for all data types must be integers, and sparse indices must be integers. And just to clarify, was this a text file you formatted yourself to be read into Octave, or one created in Octave using the save function?

Mike Miller <mtmiller>
Group Member
Tue 26 Feb 2013 06:16:50 PM UTC, original submission:  

I have an Octave-format text file that (inadvertently) contained a column index of '1e+05' in a sparse matrix. This confused Octave, of course, but the resulting error messages was quite unhelpful:


invalid sparse matrix: column index = 0 out of range


In particular, there was no indication of where in the (1.6MB compressed) input file the error occurred. Fortunately, JordiGH helped me track it down on IRC, but more helpful error reporting for corrupt input would be very appreciated.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #37017:  a added by lachlan (162B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (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 group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-16 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2016-04-29 lachlan Attached File- Added a, #37017
    2016-02-26 lachlan Attached File- Added bug_38414_sparse_load.cset, #36468
        StatusConfirmed Patch Submitted
        Assigned toNone lachlan
        Release3.4.2 dev
    2013-10-17 rik5 Priority5 - Normal 3 - Low
    2013-04-20 mtmiller CategoryNone Interpreter
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code