[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [changeset] histc
From: |
Jaroslav Hajek |
Subject: |
Re: [changeset] histc |
Date: |
Sun, 8 Mar 2009 19:14:58 +0100 |
On Sun, Mar 8, 2009 at 6:50 PM, Søren Hauberg <address@hidden> wrote:
> Hi All
>
> I just needed the 'histc' function, so I decided to write it.
>
> I'm attaching a changeset that adds this function.
>
> Okay to push?
>
> Søren
>
Several comments:
1. your test for sortedness will gripe for descending arrays. I think
it can simply go like this
if (! issorted (edges))
warn (...)
edges = sort (edges);
endif
I think the best possible m-file implementation of histc is to combine
lookup (which gives you idx directly) and accumarray (which can count
the numbers of indices in idx). Currently, accumarray uses a general
approach based on sorting the index array, i.e. O(N log N). I intend
to specialize it for certain standard reductions, such as sum, prod,
min, max to get an efficient linear-time implementation, but I thought
I won't make it until 3.2. Do you have a good reason why you wnat this
function in 3.2? I think it's not much work, I just postponed because
we already entered the "feature freeze" state.
Of course, we may also go with this implementation and I'll contribute
a more optimal one after 3.2.
cheers
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz