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

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

[Octave-bug-tracker] [bug #53198] nnz could be improved for diagonal mat


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #53198] nnz could be improved for diagonal matrices
Date: Wed, 21 Feb 2018 16:25:54 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #3, bug #53198 (project octave):

I've applied a second test with


N = 1e2;

f = zeros(N,1);
for i=1:N
  s = diag(1,1,5000);
  tic;
  z = nnz(s);
  f(i)=toc;
endfor

z
sum(f)


And I don't see any consequence of the patch


octave:1> % Pre-patch
octave:1> test
ans =  17.969
octave:2> test2
z =  1
ans =  0.0031841



octave:1> % Post-patch
octave:1> test
ans =  0.0032768
octave:2> test2
z =  1
ans =  0.0043147


I take it that in this scenario:


      if (k == 0)
        // Returns Diag2Array<T> with nnz <= 1.
        retval = matrix.build_diag_matrix ();
      else


the matrix representation is some other class that has a fast implementation
of nnz().  So that's good.

One other note: be sure to check changesets for any dangling whitespace.  If
you are running linux, type "hg diff" at a bash shell and you are likely to
see highlighted red blocks wherever there is whitespace after the last
character.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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