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

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

[Octave-bug-tracker] [bug #32011] Tweak : sparse matrix should report 10


From: Rik
Subject: [Octave-bug-tracker] [bug #32011] Tweak : sparse matrix should report 100% when full rather than 1e02%
Date: Tue, 04 Jan 2011 20:34:39 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/9.10 (karmic) Firefox/3.6.13

Follow-up Comment #2, bug #32011 (project octave):

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%.


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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