bugGNU Octave - Bugs: bug #32011, Tweak : sparse matrix should...

 
 

bug #32011: Tweak : sparse matrix should report 100% when full rather than 1e02%

Submitter:  Rik <rik5>
Submitted:  Thu 30 Dec 2010 05:27:50 PM UTC
   
 
Category:  None Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
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
   

Tue 04 Jan 2011 10:01:25 PM UTC, comment #3: 

I checked in the following change:

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

It avoids printing 100% except for completely full matrices and allows printing up to 99.99% full (saturates there for anything greater but not 100%).

John W. Eaton <jwe>
Group administrator
Tue 04 Jan 2011 08:34:39 PM UTC, comment #2: 

This patch has the slight disadvantage that it reports nearly empty matrices as empty.  Under the old system:


octave:1> a = sparse(1e4,1e4)
a =

Compressed Column Sparse (rows = 10000, cols = 10000, nnz = 0 [0%])


octave:2> a(1) = 1
a =

Compressed Column Sparse (rows = 10000, cols = 10000, nnz = 1 [1e-06%])

  (1, 1) ->  1

or

octave:3> a = sparse(1e2,1e2)
a =

Compressed Column Sparse (rows = 100, cols = 100, nnz = 0 [0%])


octave:4> a(1) = 1
a =

Compressed Column Sparse (rows = 100, cols = 100, nnz = 1 [0.01%])

  (1, 1) ->  1


With your patch it reports these examples as 0%.  Of course, the current code has the opposite trouble.  Anything above 99.5% is reported as 1e02%.  I suppose this is preferable because sparse matrices should generally be empty rather than full.

What about keeping the existing code, but using an explicit test for 100% full?  This isn't performance critical code since it is only for output to a user who is millions of times slower than the computer.

I'm thinking of 3 cases.

1) Matrix is not full and density is less than 99.5%.
   Use existing code.

2) Matrix is not full, but density is greater than 99.5%
   Report 99.5% full.  This avoids the round-off error which
   would make this 100% if printed normally.  At a glance
   one can see that the matrix is very dense, but not full.

3) Matrix is full.  All elements are non-zero
   Report 100%.

Rik <rik5>
Group administrator
Thu 30 Dec 2010 06:58:00 PM UTC, comment #1: 

Here's a simple patch.


octave:1> a = sparse ([1,0])
a =

Compressed Column Sparse (rows = 1, cols = 2, nnz = 1 [50%])

  (1, 1) ->  1

octave:2> a(end) = 1
a =

Compressed Column Sparse (rows = 1, cols = 2, nnz = 2 [100%])

  (1, 1) ->  1
  (1, 2) ->  1


(file #22325)

Judd Storrs <judd>
Thu 30 Dec 2010 05:27:50 PM UTC, original submission:  

This is a small niggle, but when sparse matrices report their density they usually use the form XX%.  However, if the matrix has all of its entries as non-zero, it reports 1e02% rather than 100%.


a = sparse ([1,0])
a =

Compressed Column Sparse (rows = 1, cols = 2, nnz = 1 [50%])

  (1, 1) ->  1

octave:2> a(end) = 1
a =

Compressed Column Sparse (rows = 1, cols = 2, nnz = 2 [1e+02%])

  (1, 1) ->  1
  (1, 2) ->  1


Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #22325:  bug32011.patch added by judd (1KiB - text/x-patch)

 

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 judd (Updated the item)
  • -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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-04 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2010-12-30 judd Attached File- Added bug32011.patch, #22325

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code