bugGNU Octave - Bugs: bug #45963, sparse matrices with negative size

 
 

bug #45963: sparse matrices with negative size

Submitted by:  None
Submitted on:  Mon 14 Sep 2015 07:32:03 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: OpenRelease: 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.

 

Wed 16 Sep 2015 12:25:53 PM UTC, comment #3:

Yes, we should detect dimensions that are out of range properly and avoid generating negative dimensions.

However, there are some other issues with dimensions of sparse matrices that tend to annoy people and that may be harder to fix. For example, there is no problem creating the following matrix

but the expression x(:) will fail because the linear index of the last element (1e12) is too large to be an index, at least with 32-bit indexing.

John W. Eaton <jwe>
Project Administrator
Tue 15 Sep 2015 11:35:33 AM UTC, comment #2:

The erroneous behavior of comment #1 has it roots very deep inside liboctave/array/Spase.h . There is

When you call

nr = 1e20 and nc = 1 get directly forwarded from the interpreter only with a check for nonnegativity!!! If you swapped the parameters, nc = 1e20 causes the creation of a too large array and results in a bad_alloc exception.

To my opinion this is a problem that should be addressed in the dim_vector class. It should be impossible to exceed the min and max index.

Kai Torben Ohlhus <siko1056>
Project Member
Mon 14 Sep 2015 11:19:53 PM UTC, comment #1:

Another little bug:

>> s = sparse(1e20,1)

s = Compressed Column Sparse (rows = 2147483647, cols = 1, nnz = 0 [0%])

whereas these constructors recognize the index limit.

>> s = sparse(1e20,1,0)

error: sparse: subscript indices must be either positive integers less than 2^31 or logicals

>> s = sparse(1,1e20)

error: out of memory or dimension too large for Octave's index type

Ceral Paquet <octavebugs>
Mon 14 Sep 2015 07:32:03 PM UTC, original submission:

In both 4.0.0 and hg tip, built with default options on x86-64, the following code makes sparse matrices with a negative number of rows:

Probably expected result: "error: out of memory or dimension too large for Octave's index type" from each of the three commands.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by siko1056 (Posted a comment)
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by octavebugs (Posted a comment)
  •  

    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):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Sep 2015 02:10:54 AM UTCmtmillerStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1