[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54275] repelem error if a repeat instruction
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #54275] repelem error if a repeat instruction is a vector that ends with 0 |
Date: |
Mon, 9 Jul 2018 14:34:31 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0 |
Update of bug #54275 (project octave):
Status: None => Fixed
Open/Closed: Open => Closed
Summary: repelem error if a repeat instruction is a vector
ends with 0 => repelem error if a repeat instruction is a vector that ends
with 0
_______________________________________________________
Follow-up Comment #2:
Confirmed. As noted in the title, this is a problem only when the last
position is a 0.
I would prefer not to call out to a second function (repelems) because there
is a fair amount of interpreter overhead in calling a function.
Since methods 1 and 3 both work, the only question is performance. I made a
small benchmark
N = 1e4;
bm = zeros (N, 1);
base = [1:10];
rep = [9:-1:0];
for i = 1:N
tic;
c = repelem (base, rep);
bm(i) = toc;
endfor
The results are
Patch 1:
------------------------------------------------------------
octave:11> mean (bm)
ans = 0.00017877
octave:12> median (bm)
ans = 0.00016284
octave:13> std (bm)
ans = 0.000072822
Patch 3:
------------------------------------------------------------
octave:5> mean (bm)
ans = 0.00015290
octave:4> median (bm)
ans = 0.00013614
octave:6> std (bm)
ans = 0.000080379
Patch three is the winner (although we're only talking about 20
milliseconds).
I committed the patch to the stable branch here
(http://hg.savannah.gnu.org/hgweb/octave/rev/9277b77dd28f).
Marking as fixed and closing report.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54275>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/