bugGNU Octave - Bugs: bug #33601, Sparse bool matrices lose logical...


bug #33601: Sparse bool matrices lose logical class with assignment of 1

Submitter:  Rik <rik5>
Submitted:  Mon 20 Jun 2011 01:40:05 AM UTC
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 20 Jun 2011 05:29:53 PM UTC, comment #2: 

Why not add the tests to the list for the upcoming code sprint which is dedicated to improving test coverage?  Hopefully, we will have some extra able bodies to assist in writing the new tests.  But as a first step, go ahead and add it to the task tracker so it doesn't get lost.

Rik <rik5>
Group administrator
Mon 20 Jun 2011 03:19:03 PM UTC, comment #1: 

I checked in the following changeset:


I also checked in the following related changeset, for assignment of [], '', or "" to delete elements from sparse logical arrays:


It would be great if there were some new tests added for these operations.  I'm not sure whether there are any tests for the double and complex cases yet.  If there are, then the new tests should probably be added in a way that is consistent with the dobule/complex tests.  Otherwise, I'd suggest a new section in the build_sparse_tests.sh script.  Maybe I should just add this to the task tracker so we don't forget?

John W. Eaton <jwe>
Group administrator
Mon 20 Jun 2011 01:40:05 AM UTC, original submission:  

Sparse matrices support an underlying type of class double or class logical.  The double class normally takes 8 bytes to store while the logical class only takes 1 byte so it is advantageous to use sparse logical matrices where possible.

Unfortunately, assignment of 0 or 1 will promote a sparse logical matrix to a sparse double matrix even though it is unnecessary and even though the equivalent operation using full matrices would not cause such a promotion.

Some example code:

s = sparse(false(10,10));
ans = sparse bool matrix
s(1) = 1;
ans = sparse matrix

The same operation on a full matrix
f = false (10,10);
ans = bool matrix
f(1) = 1;
ans = bool matrix

Rik <rik5>
Group administrator


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

Attach Files:

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 rik5 (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-06-20 jwe StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-ee12.
    Corresponding source code