On Fri, Nov 19, 2010 at 12:55 PM, Nathaniel Smith <[email protected]> wrote:
> On Fri, Nov 19, 2010 at 10:33 AM, Keith Goodman <[email protected]> > wrote: > > Nanny uses the magic of Cython to give you a faster, drop-in replacement > for > > the NaN functions in NumPy and SciPy. > > Neat! > > 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[0]): > best_nansum(ary[i, :, :], axis=1) > > > - functions: nansum > > - Operating systems: 64-bit (accumulator for int32 is hard coded to > int64) > > - 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? Ben Root
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
