On Jun 7, 2011, at 3:17 PM, Keith Goodman wrote: > What is the rule to determine the dtype returned by numpy functions > that return indices such as np.argmax?
The return type of indices will be np.intp. I don't know if Cython provides that type or not. If not, then it is either np.int32 or np.int64 depending on the system. Best , -Travis > > I assumed that np.argmax() returned the same dtype as np.int_. That > works on linux32/64 and win32 but on win-amd64 np.int_ is int32 and > np.argmax() returns int64. > > Someone suggested using intp. But I can't figure out how to do that in > Cython since I am unable to cimport NPY_INTP. So this doesn't work: > > from numpy cimport NPY_INTP > cdef np.ndarray[np.intp_t, ndim=1] output = PyArray_EMPTY(1, dims, NPY_INTP, > 0) > > Is there another way? All I can think of is checking whether np.intp > is np.int32 or int64 when I template the code. > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion --- Travis Oliphant Enthought, Inc. oliph...@enthought.com 1-512-536-1057 http://www.enthought.com _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion