[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Octave-bug-tracker] [bug #36372] Improved ranks.m included:
From: |
Dave Goel |
Subject: |
Re: [Octave-bug-tracker] [bug #36372] Improved ranks.m included: |
Date: |
Mon, 21 Oct 2013 22:39:48 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
Hi Mike
Been a while since I submitted this, so I am a bit hazy.
But, it looks like in the current version, the slowness comes out when
sorting on dim 2, as below:
octave:4> version
ans = 3.6.2
octave:5> a=round(10*rand(100123,100));
octave:6> tic; ranksmy(a,2); toc
Elapsed time is 1.8450469971 seconds.
(attaching the latest ranksmy.m I have, which is an adaptation of
KH's original ranks.m, and .
(1) Jordigh: The comments about "ugliness" were not mine, but
KH's. I have removed them, nonetheless.
Note (2) Secondly, this ranksmy.m, while equivalent to the built-in
ranks.m by default, also provides several ranking variants in case of
collisions:
competition, fractional, modified competition, ordinal, reverse ordinal,
and dense ranking. Again, unlike the original case, each is efficient,
and none uses for loops.
Now, let's try, for comparison, the built-in function:
octave:7> tic; ranks(a,2); toc
Elapsed time is 48.160676956 seconds.
That's a factor of 25.
Plus, the difference increases greatly as you increase the size, because
one vectorizes and the other loops.
-----Original Message-----
Mike Miller <address@hidden> writes:
> Update of bug #36372 (project octave):
>
> Category: None => Octave Function
> Status: Patch Submitted => Need Info
>
> _______________________________________________________
>
> Follow-up Comment #8:
>
> This bug has been idle for some time.
>
> As I understand it, the original bug report here says that the performance of
> the ranks function is poor when operating on some input like the following:
>
>
> a = round (10 * rand (100123, 100));
> x = ranks (a);
>
>
> However, on my system with the current development version, the call to ranks
> returns in 2-3 seconds. So I'm not sure if I'm not understanding what the OP
> was reporting or if the problem is simply no longer present.
>
> Also it would be real nice if the changes could be attached as a file, even
> better as a patch to the current function, and better still as a mercurial
> changeset. The bug tracker seems to flatten all indenting so the text pasted
> here is less useful.
>
> _______________________________________________________
>
> Reply to this item at:
>
> <http://savannah.gnu.org/bugs/?36372>
>
> _______________________________________________
> Message sent via/by Savannah
> http://savannah.gnu.org/
ranksmy.m
Description: Binary data