[Numpy-discussion] A faster median (Wirth's method)
Matthew Brett
matthew.brett at gmail.com
Tue Nov 30 14:58:55 EST 2010
Hi,
On Tue, Nov 30, 2010 at 11:35 AM, Keith Goodman <kwgoodman at gmail.com> wrote:
> On Tue, Nov 30, 2010 at 11:25 AM, John Salvatier
> <jsalvati at 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),
See you,
Matthew
More information about the NumPy-Discussion
mailing list