[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52919] comparison of complex values
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #52919] comparison of complex values |
Date: |
Fri, 19 Jan 2018 17:53:12 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #12, bug #52919 (project octave):
Irrespective of the sorting order, it does seem like sorting of complex
numbers is rather slow.
I used the following test code which is also attached
N = 1e3;
x = [1e6:-1:1]';
y = x + 1i;
z = zeros (size (x));
bm1 = bm2 = bm3 = zeros (N,1);
for i = 1:N
tic;
z = sort (x);
bm1(i) = toc;
tic;
z = sort (y);
bm2(i) = toc;
tic;
z = sort (abs (y));
bm3(i) = toc;
endfor
mean (bm1)
mean (bm2)
mean (bm3)
The results were
ans = 0.0028022
ans = 0.025930
ans = 0.011031
So sorting of complex numbers is about 10X slower than reals. And more
importantly, it is abot 2.5X slower than the equivalent sort (abs (y))
command. The y values chosen all differ in abs() so it is not a question of
extra processing of the phase angle. It seems there are just a lot of hoops
to go through before the correct code is engaged.
(file #42980)
_______________________________________________________
Additional Item Attachment:
File name: bm_sort.m Size:0 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52919>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52919] comparison of complex values, (continued)
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Mike Miller, 2018/01/17
- [Octave-bug-tracker] [bug #52919] comparison of complex values, John W. Eaton, 2018/01/17
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Mike Miller, 2018/01/17
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Michael Leitner, 2018/01/18
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Doug Stewart, 2018/01/18
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Michael Leitner, 2018/01/18
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Michael Godfrey, 2018/01/18
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Doug Stewart, 2018/01/18
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Rik, 2018/01/19
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Mike Miller, 2018/01/19
- [Octave-bug-tracker] [bug #52919] comparison of complex values,
Rik <=
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Michael Leitner, 2018/01/22
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Rik, 2018/01/22
- [Octave-bug-tracker] [bug #52919] comparison of complex values, Michael Godfrey, 2018/01/30