[Numpy-discussion] [ANN] Nanny, faster NaN functions

Keith Goodman kwgoodman@gmail....
Fri Nov 19 22:07:29 CST 2010


On Fri, Nov 19, 2010 at 8:05 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:

> This doesn't look right:
>
> @cython.boundscheck(False)
> @cython.wraparound(False)
> def nanmax_2d_float64_axisNone(np.ndarray[np.float64_t, ndim=2] a):
>     "nanmax of 2d numpy array with dtype=np.float64 along axis=None."
>     cdef Py_ssize_t i, j
>     cdef int arow = a.shape[0], acol = a.shape[1], allnan = 1
>     cdef np.float64_t amax = 0, aij
>     for i in range(arow):
>         for j in range(acol):
>             aij = a[i,j]
>             if aij == aij:
>                 amax += aij
>                 allnan = 0
>     if allnan == 0:
>         return np.float64(amax)
>     else:
>         return NAN
>
>  It's doing a sum, not a comparison.

That was a placeholder. Looks at the latest commit. Sorry for the confusion.


More information about the NumPy-Discussion mailing list