bugGNU Octave - Bugs: bug #40294, Logical indexing into sparse...

 
 

bug #40294: Logical indexing into sparse matrix hangs/segfaults

Submitter:  David Spies <dspyz>
Submitted:  Thu 17 Oct 2013 07:07:53 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  dspies Open/Closed:  * Closed
Release:  * 3.2.4 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 17 Oct 2013 10:10:11 PM UTC, comment #5: 

I don't know why Ubuntu decided to package such an ancient version.  In any case, you can use this PPA to get the latest stable version which is 3.6  (https://launchpad.net/~octave/+archive/stable).  It is maintained by Mike Miller who is a contributor to Octave.  I tested your code and it works on 3.6.

Rik <rik5>
Group administrator
Thu 17 Oct 2013 09:14:00 PM UTC, comment #4: 

Rik,

You're right this is a case of "logical indexing" rather than "sparse logical indexing" and the bug should probably be closed

D.

David Bateman <dbateman>
Group Member
Thu 17 Oct 2013 09:05:11 PM UTC, comment #3: 

Thanks Rik,

Unfortunately I'm stuck with this version because it's the one that's compatible with https://kenai.com/projects/javaoctave/pages/Home
I tried using it with the dev version and just got syntax errors and segfaults everywhere.

If you know of another more current tool with the same functionality, I'd love to switch to it.

Also, 3.2.4 is the version of Octave available from aptitude on Ubuntu 12.04.

Thanks,
David

David Spies <dspyz>
Thu 17 Oct 2013 08:49:27 PM UTC, comment #2: 

I note that you are using version 3.2.4 which is ancient and deprecated.  I tried your problem on the soon-to-be-released 3.8 code and it returns instantly without problem.

Of course, if you try


m(v,:) = 1;


Octave segfaults which is definitely bad.  It should just issue a warning message.

Rik <rik5>
Group administrator
Thu 17 Oct 2013 07:41:48 PM UTC, comment #1: 

This is known problem and is documented on the Projects page since 2006. See

http://wiki.octave.org/Projects#Sparse_Matrices

where it says


Sparse logical indexing in idx_vector class so that something like 'a=sprandn(1e6,1e6,1e-6); a(a<1) = 0' won't cause a memory overflow.


At the moment the sparse logical indexing is converted in full matrix indexing and in your case you're are probably swapping madly rather than getting a memory overflow.

Its not that easy to implement and its always seemed that the amount of work to implemen it was always more than it was worth since as you've found there always seems to be a manner to work around it.

I'd suggest leaving this bug open, but giving it a low priority

D.

David Bateman <dbateman>
Group Member
Thu 17 Oct 2013 07:07:53 PM UTC, original submission:  

After:

m = sparse(100000,100000);
v = logical(sprand(100000,1,0.3));

The operation:

m(v,:) = 0;

hangs (the same happens when 0 is replaced with a sparse matrix of the appropriate size).

However

m -= diag(v) * m

works just fine

David Spies <dspyz>

 

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

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

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-17 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2013-10-17 rik5 Item GroupPerformance Segfault, Bus Error, etc.
        SummaryLogical indexing into sparse matrix hangs Logical indexing into sparse matrix hangs/segfaults

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code