Open thouis opened 12 years ago
Comment in Trac by atmention:stefanv, 2006-08-03
Can be improved by changing to NPY_UINTP, but that still won't allow 64-bit integers. Is there a way to easily fix this for 32-bit systems?
Comment in Trac by atmention:alberts, 2007-05-12
Comment in Trac by atmention:cournape, 2009-03-02
Comment in Trac by atmention:mwiebe, 2011-03-23
This function still errors (with uint64 on a 64-bit machine). Bincount is a candidate to convert to using the iterator with buffering, since currently it will cause a copy if the input isn't contiguous and the right type.
Comment in Trac by atmention:bsouthey, 2011-05-09
My C is not very good but hopefully someone with can correct the patch. The less obvious change (at least was to me) was that PyArray_ContiguousFromAny was being called with unsigned int, PyArray_INTP, rather than PyArray_UINTP.
According to the comment on the bincount code in "numpy/lib/src/_compiled_base.c", the first argument must be '''an array of non-negative integers''' (relevant lines): * bincount accepts one, two or three arguments. The first is an array of * non-negative integers The second, if present, is an array of weights,
Consequently I changed bincount to use unsigned ints instead of signed ints.
The patch is incorrect if the ''mxx'' and ''mnx'' functions can be used outside of bincount. In that case new functions would have to declared.
Attachment in Trac by atmention:bsouthey, 2011-05-09: 0001-bincount-unsigned-ints.patch
Attachment in Trac by atmention:bsouthey, 2011-05-09: 0002-Redo-bincount-signed-int-change.patch
Comment in Trac by atmention:bsouthey, 2011-05-09
Okay, still was not that simple! I had to change one PyObject variable into PyArrayObject. This allowed to get the input dtype for PyArray?_ContiguousFromAny. Both patches need to be applied because I do not know how to get a single patch with git without redoing everything - '''sorry'''!
Original ticket http://projects.scipy.org/numpy/ticket/225 Reported 2006-08-03 by atmention:stefanv, assigned to atmention:teoliphant.
Under r2944: