summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2013-01-25 19:36:35 +0100
committerSebastian Berg <sebastian@sipsolutions.net>2013-02-10 14:40:23 +0100
commit7ccf5308193eef9c5fb0a3ee3d4e84562784c31b (patch)
tree176c45599e1fb24e9e605160617d05f062bc6d49
parent625f3cde9aeacea2289ba32286ec54a65f4f4641 (diff)
downloadnumpy-7ccf5308193eef9c5fb0a3ee3d4e84562784c31b.tar.gz
BUG: Fix dtypes in sorting functions to npy_intp
Some of the iteration variables were int, causing sorts to fail for large arrays. Fixes github issue 427.
-rw-r--r--numpy/core/src/multiarray/item_selection.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c
index 0da921b62..87e84e04d 100644
--- a/numpy/core/src/multiarray/item_selection.c
+++ b/numpy/core/src/multiarray/item_selection.c
@@ -795,10 +795,10 @@ _new_argsort(PyArrayObject *op, int axis, NPY_SORTKIND which)
PyArrayIterObject *it = NULL;
PyArrayIterObject *rit = NULL;
PyArrayObject *ret;
- int needcopy = 0, i;
- npy_intp N, size;
- int elsize, swap;
+ npy_intp N, size, i;
npy_intp astride, rstride, *iptr;
+ int elsize;
+ int needcopy = 0, swap;
PyArray_ArgSortFunc *argsort;
NPY_BEGIN_THREADS_DEF;
@@ -952,7 +952,8 @@ PyArray_Sort(PyArrayObject *op, int axis, NPY_SORTKIND which)
{
PyArrayObject *ap = NULL, *store_arr = NULL;
char *ip;
- int i, n, m, elsize, orign;
+ npy_intp i, n, m;
+ int elsize, orign;
int res = 0;
int axis_orig = axis;
int (*sort)(void *, size_t, size_t, npy_comparator);
@@ -1208,13 +1209,12 @@ PyArray_LexSort(PyObject *sort_keys, int axis)
PyArrayIterObject **its;
PyArrayObject *ret = NULL;
PyArrayIterObject *rit = NULL;
- int n;
+ npy_intp n, N, size, i, j;
+ npy_intp astride, rstride, *iptr;
int nd;
- int needcopy = 0, i,j;
- npy_intp N, size;
+ int needcopy = 0;
int elsize;
int maxelsize;
- npy_intp astride, rstride, *iptr;
int object = 0;
PyArray_ArgSortFunc *argsort;
NPY_BEGIN_THREADS_DEF;