T J wrote: > On Fri, Mar 26, 2010 at 12:00 AM, Dag Sverre Seljebotn > <[email protected]> wrote: >> I expect you are doing lots and lots of really small summations? >> Otherwise there's no real point. >> > > Correct...lots of very small sums. > >> You unfortunately need to do >> >> cdef double sum(object x, unsigned int >> start, unsigned int stop, int skip): >> cdef np.ndarray[np.float64_t, ndim=1] x_buf = x >> >> > > Thanks! > > >> then use x_buf. There's a slight speed penalty with that assignment which >> >> Also, please use Py_ssize_t instead of unsigned int. unsigned ints are >> dangerous in Cython. >> > > Whoops. I was following: > http://wiki.cython.org/tutorials/numpy > to avoid negative indexes, but I just found negative_indexes=False: > http://wiki.cython.org/enhancements/buffer
And now the preferred method is @cython.wraparound(False) This is best explained in http://conference.scipy.org/proceedings/SciPy2009/paper_2/ Feel free to update the wiki. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
