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


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

Submitted by:  None
Submitted on:  Tue 26 Feb 2013 06:16:50 PM UTC  
Category: InterpreterSeverity: 3 - Normal
Priority: 3 - LowItem Group: Other
Status: FixedAssigned to: Lachlan Andrew <lachlan>
Originator Name: Michael EkstrandOriginator Email: -unavailable-
Open/Closed: ClosedRelease: dev
Operating System: GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission 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>
Project 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>
Project 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

and having 1e+05 in column 2 gives

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

(file #37017)

Lachlan Andrew <lachlan>
Project MemberIn charge of this item.
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>
Project 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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project Administrator
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:

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.



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

Attach File(s):

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
  • -unavailable- added by lachlan (Posted a comment)
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 16 May 2016 04:01:12 AM UTCrik5StatusPatch Submitted=>Fixed
    Fri 29 Apr 2016 01:53:20 AM UTClachlanAttached File-=>Added a, #37017
    Fri 26 Feb 2016 09:27:47 AM UTClachlanAttached File-=>Added bug_38414_sparse_load.cset, #36468
      StatusConfirmed=>Patch Submitted
      Assigned toNone=>lachlan
    Thu 17 Oct 2013 09:36:30 PM UTCrik5Priority5 - Normal=>3 - Low
    Sat 20 Apr 2013 12:16:01 AM UTCmtmillerCategoryNone=>Interpreter

    Back to the top

    Powered by Savane 3.1-cleanup1