[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52342] vecnorm command
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #52342] vecnorm command |
Date: |
Tue, 7 Nov 2017 01:00:07 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #7, bug #52342 (project octave):
@Marco: Benchmarking is pretty hard to get right. First, one generally needs
to repeat the test several times. Second, The way your test was structured on
one line means that the CPU's dynamic frequency scaling was probably not fully
engaged for the first calculation using abs(), but was for the second part of
the test. That gives an unfair advantage to the vectorized code.
I wrote a small benchmark script (bm_abs.m) which is attached.
N = 10;
bm = zeros (N,1);
bm2 = zeros (N,1);
for i = 1:N
tic;
(abs(A)).^p;
bm(i) = toc;
tic;
(real(A).^2+imag(A).^2).^(p/2);
bm2(i) = toc;
endfor
printf ("abs: %f\n", median (bm));
printf ("vec: %f\n", median (bm2));
The results for various p values are shown below:
p = 1
abs: 0.925663
vec: 2.668234
p = 2
abs: 1.033491
vec: 1.123011
p = 3
abs: 0.700889
vec: 2.656083
p = 4
abs: 2.472564
vec: 0.884022
p = 5
abs: 2.525005
vec: 2.689880
p = 6
abs: 2.508996
vec: 0.885091
p = 7
abs: 2.517311
vec: 2.630967
p = 8
abs: 2.498222
vec: 2.637875
Definitely some weirdness associated with p = [4,6]. I don't think those are
common choices, so it may be best to stay with abs().
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52342>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52342] vecnorm command, CH, 2017/11/05
- [Octave-bug-tracker] [bug #52342] vecnorm command, Marco Caliari, 2017/11/06
- [Octave-bug-tracker] [bug #52342] vecnorm command, CH, 2017/11/06
- [Octave-bug-tracker] [bug #52342] vecnorm command, Marco Caliari, 2017/11/06
- [Octave-bug-tracker] [bug #52342] vecnorm command, CH, 2017/11/06
- [Octave-bug-tracker] [bug #52342] vecnorm command, Marco Caliari, 2017/11/06
- [Octave-bug-tracker] [bug #52342] vecnorm command, CH, 2017/11/06
- [Octave-bug-tracker] [bug #52342] vecnorm command,
Rik <=
- [Octave-bug-tracker] [bug #52342] vecnorm command, Rik, 2017/11/07
- [Octave-bug-tracker] [bug #52342] vecnorm command, Marco Caliari, 2017/11/07
- [Octave-bug-tracker] [bug #52342] vecnorm command, Marco Caliari, 2017/11/08
- [Octave-bug-tracker] [bug #52342] vecnorm command, Rik, 2017/11/09