[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51880] sparse() ignores value of scalar colum
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #51880] sparse() ignores value of scalar column index input arg |
Date: |
Tue, 5 Sep 2017 21:06:24 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Update of bug #51880 (project octave):
Status: Ready For Test => Fixed
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #8:
Only way to know was to benchmark it. Indeed, the resizing of the SparseRep
was not a driver of execution time. However, I did find that using
std::fill_n over only the non-zero columns provided ~20% savings.
The benchmark code was
N = 1e3;
bm = zeros (N, 1);
for i = 1:N
clear x;
tic;
x = sparse (1:2:2000, 9999, 1:1000, 1e4, 1e4);
bm(i) = toc;
pause (.010);
endfor
By putting everything in the next to last column this was clearly worst case,
but it did beat the handcoded for loop. Replacement code was
- xcidx (0) = 0;
- for (octave_idx_type j = 0; j < nc; j++)
- xcidx (j+1) = j >= c(0) ? new_nz : 0;
+ std::fill_n (xcidx () + c(0) + 1, nc - c(0), new_nz);
I checked in the full cset here
(http://hg.savannah.gnu.org/hgweb/octave/rev/584971932def).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51880>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/