[Numpy-discussion] A faster median (Wirth's method)

John Salvatier jsalvati@u.washington....
Tue Nov 30 21:22:00 CST 2010


I think last time I looked into how to apply a function along an axis I
thought that the PyArray_IterAllButAxis would not work for that task (
http://docs.scipy.org/doc/numpy/reference/c-api.array.html#PyArray_IterAllButAxis),
but I think perhaps I misunderstood it. I'm looking into how to use it.

On Tue, Nov 30, 2010 at 12:06 PM, Keith Goodman <kwgoodman@gmail.com> wrote:

> On Tue, Nov 30, 2010 at 11:58 AM, Matthew Brett <matthew.brett@gmail.com>
> wrote:
> > Hi,
> >
> > On Tue, Nov 30, 2010 at 11:35 AM, Keith Goodman <kwgoodman@gmail.com>
> wrote:
> >> On Tue, Nov 30, 2010 at 11:25 AM, John Salvatier
> >> <jsalvati@u.washington.edu> wrote:
> >>> I am very interested in this result. I have wanted to know how to do an
> >>
> >> My first thought was to write the reducing function like this
> >>
> >> cdef np.float64_t namean(np.ndarray[np.float64_t, ndim=1] a):
> >>
> >> but cython doesn't allow np.ndarray in a cdef.
> >
> > Sorry for the ill-considered hasty reply, but do you mean that this:
> >
> > import numpy as np
> > cimport numpy as cnp
> >
> > cdef cnp.float64_t namean(cnp.ndarray[cnp.float64_t, ndim=1] a):
> >    return np.nanmean(a)  # just a placeholder
> >
> > is not allowed?  It works for me.  Is it a cython version thing?
> > (I've got 0.13),
>
> Oh, that's nice! I'm using 0.11.2. OK, time to upgrade.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101130/41d08559/attachment.html 


More information about the NumPy-Discussion mailing list