[Numpy-discussion] [ANN] Nanny, faster NaN functions
Fri Nov 19 13:12:09 CST 2010
On Fri, Nov 19, 2010 at 12:55 PM, Nathaniel Smith <firstname.lastname@example.org> wrote:
> On Fri, Nov 19, 2010 at 10:33 AM, Keith Goodman <email@example.com>
> > Nanny uses the magic of Cython to give you a faster, drop-in replacement
> > the NaN functions in NumPy and SciPy.
> Why not make this a patch to numpy/scipy instead?
> > Nanny uses a separate Cython function for each combination of ndim,
> dtype, and
> > axis. You can get rid of a lot of overhead (useful in an inner loop,
> e.g.) by
> > directly importing the function that matches your problem::
> > >> arr = np.random.rand(10, 10)
> > >> from nansum import nansum_2d_float64_axis1
> If this is really useful, then better to provide a function that finds
> the correct function for you?
> best_nansum = ny.get_best_nansum(ary[0, :, :], axis=1)
> for i in xrange(ary.shape):
> best_nansum(ary[i, :, :], axis=1)
> > - functions: nansum
> > - Operating systems: 64-bit (accumulator for int32 is hard coded to
> > - dtype: int32, int64, float64
> > - ndim: 1, 2, and 3
> What does it even mean to do NaN operations on integers? (I'd
> sometimes find it *really convenient* if there were a NaN value for
> standard computer integers... but there isn't?)
> -- Nathaniel
That's why I use masked arrays. It is dtype agnostic.
I am curious if there are any lessons that were learned in making Nanny that
could be applied to the masked array functions?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion