octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #40341] Logical indexing into sparse matrices


From: Rik
Subject: [Octave-bug-tracker] [bug #40341] Logical indexing into sparse matrices causes OOM
Date: Wed, 1 Aug 2018 18:29:40 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #11, bug #40341 (project octave):

This bug still exists, but in practical terms things have gotten better. 
Octave is now built by default with 63-bit indexing vectors rather than 31-bit
vectors.  For sparse matrices, this leads to square matrices with 3 billion
elements on a side versus just 46,000.


octave:18> format short e
octave:19> sqrt (2^63)
ans =    3.0370e+09
octave:20> sqrt (2^31)
ans =    4.6341e+04


The original code (logical indexing) now works as well.  Or you can use linear
indexing as the following code also demonstrates.


octave:22> a = sprand(100000,100000,0.0001); 
octave:23> b = logical(sprand(100000,100000,0.0001)); 
octave:24> a2 = a;
octave:25> a3 = a;
octave:26> a(b) = 0;
octave:27> isequal (a, a2)
ans = 0
octave:28> idx = find (b);
octave:29> a2(idx) = 0;
octave:30> isequal (a2, a3)
ans = 0
octave:31> isequal (a, a2)
ans = 1
octave:32> diary off




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40341>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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