[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #50575] Integer overflow in whos when calculat

From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #50575] Integer overflow in whos when calculating total elements in sparse matrices
Date: Thu, 23 Aug 2018 13:38:43 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #6, bug #50575 (project octave):

Matlab 2014a:

>> [a, maxint] = computer()
a =
maxint =

>> A = sprand(1e13, 1e7, 1e-15);

>> nnz(A)
ans =

>> size(A)
ans =
        1e+13        1e+07

>> numel(A)
Warning: Number of elements exceeds maximum flint 2^53-1.
The result may be inaccurate. 
ans =

>> whos
  Name                   Size                     Bytes  Class     Attributes

  A         10000000000000x10000000            81600008  double    sparse    

(Notice they warn in numel when > flintmax.  This seems like a good idea,
especially with 64-bit indexing: I will file different issue.)

Note, they can linear index into such a large matrix, the condition is just
that that linear index itself cannot be larger than maxint:

>> A(10,10)
ans =
   All zero sparse: 1-by-1

>> A(100)
ans =
   All zero sparse: 1-by-1

>> A(1234567)
ans =
   All zero sparse: 1-by-1

>> i = 282*int64(1000)^4 + 123
i =

>> A(i)
Maximum variable size allowed by the program is exceeded. 

>> # note i is just slightly larger than maxint
>> double(i)
ans =
>> maxint
maxint =


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]