bugGNU Octave - Bugs: bug #35148, Error Msg suppressed: tic;...

 
 

bug #35148: Error Msg suppressed: tic; sparse(1e5, 1e5, 0); toc

Submitter:  Clem <clemwang>
Submitted:  Wed 21 Dec 2011 08:10:33 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Clem Open/Closed:  * Closed
Release:  * 3.4.0 Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 16 Apr 2012 08:04:23 PM UTC, comment #5: 

I checked in the following change which seems to avoid the problem for me so I'm closing this report.

http://hg.savannah.gnu.org/hgweb/octave/rev/aa491bd9e19b

This fix will appear in the upcoming 3.6.2 release.

John W. Eaton <jwe>
Group administrator
Mon 16 Apr 2012 07:43:11 PM UTC, comment #4: 

The error happens because in


sparse (1e5, 1e5, 0)


dim_vector::safe_numel throws a std::bad_alloc exception.  However, safe_numel is only called when Octave attempts to print the result, not when the sparse matrix object is constructed.  So if you terminate the expression with a semicolon, you won't see the error.

I'm not sure why safe numel is called here.  We should be able to create a sparse matrix object like this since it doesn't require much memory, and neither of the dimensions are larger than the max index size, only the product is, but that shouldn't matter since we aren't trying to store that number of elements.


John W. Eaton <jwe>
Group administrator
Fri 13 Apr 2012 05:17:37 AM UTC, comment #3: 

I'm marking this as a regression.  3.2.4 accepts 'sparse (1e5, 1e5, 0)' without problem.  The issue first arose in 3.4.0.

Rik <rik5>
Group administrator
Wed 04 Jan 2012 11:55:24 AM UTC, comment #2: 

there is also an additional "ans" when sparse fails and no ";"
is used for line termination.

octave:1> zeros(1e5,1e5,0)
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
octave:1> sparse(1e5,1e5,0)
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
ans =

Compressed Column Sparse (rows = 100000, cols = 100000, nnz = 0octave:1>

octave:1> zeros(1e5,1e5,0);
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
octave:1> sparse(1e5,1e5,0);

Similar behaviour in spalloc

Also noted on other sparse functions

octave:4> sprandn(1e5,1e5,0.1)
panic: Aborted -- stopping myself...
attempting to save variables to `octave-core'...
save to `octave-core' complete


marco atzeri <matzeri>
Thu 22 Dec 2011 11:02:30 PM UTC, comment #1: 

This is confirmed on a recent development tip (14097:4804ad4ce0de).  The oddity is with the sparse matrix constructor in C++ and not with tic()/toc().  The equivalent for a non-sparse array behaves as expected.


zeros (1e5, 1e5);
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt




Rik <rik5>
Group administrator
Wed 21 Dec 2011 08:10:33 PM UTC, original submission:  

This is a minor bug, but I wasted some time pointlessly trying to time a bad sparse matrix creation without realizing it was in error.

I did:


>> tic; sparse(1e5, 1e5, 0); toc
Elapsed time is 0.000164986 seconds.


However, this is very missing leading since the sparse() call failed, but tic and toc seem to have suppressed the error message.  Without tic and toc, I see:


sparse(1e5, 1e5, 0)
error: memory exhausted or requested size too large for range of Octave's index type -- trying to return to prompt
ans =

Compressed Column Sparse (rows = 100000, cols = 100000, nnz = 0>>


(Note: a final LF is missing on this error, so the prompt follows the last 0 and there's a missing close paren too!)

At first, I thought this might be a generic STDERR problem, but no.  It's specific to this particular error in sparse() and who knows what other errors.  My guess is this error actually went to STDOUT instead of STDERR.

In these calls, tic and toc do not suppress errors:


>> tic; Inf/0 ; toc
warning: division by zero
Elapsed time is 0.000152 seconds.
>> tic; i2 = eye(2); i2(1i) ; toc
error: complex scalar type invalid as index value
>>tic; sparse(-1,-1,0) ; toc
error: sparse: subscript indices must be either positive integers or logicals
>>


Clem <clemwang>

 

(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 jwe (Posted a comment)
  • -email is unavailable- added by matzeri (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by clemwang (Submitted the item)
  • -email is unavailable- added by clemwang
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-04-16 jwe StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2012-04-13 rik5 Item GroupOther Regression
    2011-12-22 rik5 StatusNone Confirmed
    2011-12-21 clemwang Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code