diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-03-10 00:23:26 -0800 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-03-10 18:38:51 -0800 |
commit | ec151cc1147913ab470bba277f16a7085d69ec0c (patch) | |
tree | 20526712a6ef784b495e131927c417eeb2e28fe9 | |
parent | dede2691e7db9f0dacbc55444e5495856fa3f504 (diff) | |
download | numpy-ec151cc1147913ab470bba277f16a7085d69ec0c.tar.gz |
API: Change iterator API parameters ndim and niter from npy_intp to int
These parameters are never large, so it's better to use a straight int
instead of npy_intp, consistent with ndim in PyArrayObject as well.
-rw-r--r-- | doc/source/reference/c-api.iterator.rst | 36 | ||||
-rw-r--r-- | numpy/core/src/multiarray/einsum.c.src | 10 | ||||
-rw-r--r-- | numpy/core/src/multiarray/new_iterator.c.src | 347 | ||||
-rw-r--r-- | numpy/core/src/multiarray/new_iterator_pywrap.c | 30 | ||||
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 28 |
5 files changed, 227 insertions, 224 deletions
diff --git a/doc/source/reference/c-api.iterator.rst b/doc/source/reference/c-api.iterator.rst index adb6f6081..7812fa23d 100644 --- a/doc/source/reference/c-api.iterator.rst +++ b/doc/source/reference/c-api.iterator.rst @@ -261,7 +261,7 @@ an incomplete struct. Construction and Destruction ---------------------------- -.. cfunction:: NpyIter* NpyIter_New(PyArrayObject* op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, PyArray_Descr* dtype, npy_intp a_ndim, npy_intp* axes, npy_intp buffersize) +.. cfunction:: NpyIter* NpyIter_New(PyArrayObject* op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, PyArray_Descr* dtype, int a_ndim, int* axes, npy_intp buffersize) Creates an iterator for the given numpy array object ``op``. @@ -318,7 +318,7 @@ Construction and Destruction dtype, 0, NULL); Py_DECREF(dtype); -.. cfunction:: NpyIter* NpyIter_MultiNew(npy_intp niter, PyArrayObject** op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32* op_flags, PyArray_Descr** op_dtypes, npy_intp oa_ndim, npy_intp** op_axes, npy_intp buffersize) +.. cfunction:: NpyIter* NpyIter_MultiNew(npy_intp niter, PyArrayObject** op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32* op_flags, PyArray_Descr** op_dtypes, int oa_ndim, int** op_axes, npy_intp buffersize) Creates an iterator for broadcasting the ``niter`` array objects provided in ``op``. @@ -358,12 +358,12 @@ Construction and Destruction .. code-block:: c - npy_intp oa_ndim = 3; /* # iteration axes */ - npy_intp op0_axes[] = {0, 1, 2}; /* 3-D operand */ - npy_intp op1_axes[] = {-1, 0, 1}; /* 2-D operand */ - npy_intp op2_axes[] = {-1, -1, 0}; /* 1-D operand */ - npy_intp op3_axes[] = {-1, -1, -1} /* 0-D (scalar) operand */ - npy_intp* op_axes[] = {op0_axes, op1_axes, op2_axes, op3_axes}; + int oa_ndim = 3; /* # iteration axes */ + int op0_axes[] = {0, 1, 2}; /* 3-D operand */ + int op1_axes[] = {-1, 0, 1}; /* 2-D operand */ + int op2_axes[] = {-1, -1, 0}; /* 1-D operand */ + int op3_axes[] = {-1, -1, -1} /* 0-D (scalar) operand */ + int* op_axes[] = {op0_axes, op1_axes, op2_axes, op3_axes}; If ``buffersize`` is zero, a default buffer size is used, otherwise it specifies how big of a buffer to use. Buffers @@ -622,7 +622,7 @@ Construction and Destruction the functions will pass back errors through it instead of setting a Python exception. -.. cfunction:: int NpyIter_RemoveAxis(NpyIter* iter, npy_intp axis)`` +.. cfunction:: int NpyIter_RemoveAxis(NpyIter* iter, int axis)`` Removes an axis from iteration. This requires that ``NPY_ITER_COORDS`` was set for iterator creation, and does not work @@ -825,29 +825,29 @@ Construction and Destruction Returns ``NPY_SUCCEED`` or ``NPY_FAIL``. -.. cfunction:: int NpyIter_HasInnerLoop(NpyIter* iter) +.. cfunction:: npy_bool NpyIter_HasInnerLoop(NpyIter* iter) Returns 1 if the iterator handles the inner loop, or 0 if the caller needs to handle it. This is controlled by the constructor flag ``NPY_ITER_NO_INNER_ITERATION``. -.. cfunction:: int NpyIter_HasCoords(NpyIter* iter) +.. cfunction:: npy_bool NpyIter_HasCoords(NpyIter* iter) Returns 1 if the iterator was created with the ``NPY_ITER_COORDS`` flag, 0 otherwise. -.. cfunction:: int NpyIter_HasIndex(NpyIter* iter) +.. cfunction:: npy_bool NpyIter_HasIndex(NpyIter* iter) Returns 1 if the iterator was created with the ``NPY_ITER_C_INDEX`` or ``NPY_ITER_F_INDEX`` flag, 0 otherwise. -.. cfunction:: int NpyIter_IsBuffered(NpyIter* iter) +.. cfunction:: npy_bool NpyIter_IsBuffered(NpyIter* iter) Returns 1 if the iterator was created with the ``NPY_ITER_BUFFERED`` flag, 0 otherwise. -.. cfunction:: int NpyIter_IsGrowInner(NpyIter* iter) +.. cfunction:: npy_bool NpyIter_IsGrowInner(NpyIter* iter) Returns 1 if the iterator was created with the ``NPY_ITER_GROWINNER`` flag, 0 otherwise. @@ -857,18 +857,18 @@ Construction and Destruction If the iterator is buffered, returns the size of the buffer being used, otherwise returns 0. -.. cfunction:: npy_intp NpyIter_GetNDim(NpyIter* iter) +.. cfunction:: int NpyIter_GetNDim(NpyIter* iter) Returns the number of dimensions being iterated. If coordinates were not requested in the iterator constructor, this value may be smaller than the number of dimensions in the original objects. -.. cfunction:: npy_intp NpyIter_GetNIter(NpyIter* iter) +.. cfunction:: int NpyIter_GetNIter(NpyIter* iter) - Returns the number of objects being iterated. + Returns the number of operands in the iterator. -.. cfunction:: npy_intp* NpyIter_GetAxisStrideArray(NpyIter* iter, npy_intp axis) +.. cfunction:: npy_intp* NpyIter_GetAxisStrideArray(NpyIter* iter, int axis) Gets the array of strides for the specified axis. Requires that the iterator be tracking coordinates, and that buffering not diff --git a/numpy/core/src/multiarray/einsum.c.src b/numpy/core/src/multiarray/einsum.c.src index 5233ea524..fdad2ad10 100644 --- a/numpy/core/src/multiarray/einsum.c.src +++ b/numpy/core/src/multiarray/einsum.c.src @@ -2289,8 +2289,8 @@ get_combined_dims_view(PyArrayObject *op, int iop, char *labels) } static int -prepare_op_axes(int ndim, int iop, char *labels, npy_intp *axes, - npy_intp ndim_iter, char *iter_labels, EINSUM_BROADCAST broadcast) +prepare_op_axes(int ndim, int iop, char *labels, int *axes, + int ndim_iter, char *iter_labels, EINSUM_BROADCAST broadcast) { int i, label, ibroadcast; @@ -2703,8 +2703,8 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop, PyArrayObject *op[NPY_MAXARGS], *ret = NULL; PyArray_Descr *op_dtypes_array[NPY_MAXARGS], **op_dtypes; - npy_intp op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS]; - npy_intp *op_axes[NPY_MAXARGS]; + int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS]; + int *op_axes[NPY_MAXARGS]; npy_uint32 op_flags[NPY_MAXARGS]; NpyIter *iter; @@ -2986,7 +2986,7 @@ PyArray_EinsteinSum(char *subscripts, npy_intp nop, * be reduced to fit into these patterns. */ if (!NpyIter_RequiresBuffering(iter)) { - npy_intp ndim = NpyIter_GetNDim(iter); + int ndim = NpyIter_GetNDim(iter); switch (nop) { case 1: if (ndim == 2) { diff --git a/numpy/core/src/multiarray/new_iterator.c.src b/numpy/core/src/multiarray/new_iterator.c.src index 9f628ec55..1ce83ec72 100644 --- a/numpy/core/src/multiarray/new_iterator.c.src +++ b/numpy/core/src/multiarray/new_iterator.c.src @@ -279,10 +279,10 @@ struct NpyIter_AD { static int npyiter_check_global_flags(npy_uint32 flags, npy_uint32* itflags); static int -npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes); -static npy_intp -npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in, - npy_intp oa_ndim); +npyiter_check_op_axes(int niter, int oa_ndim, int **op_axes); +static int +npyiter_calculate_ndim(int niter, PyArrayObject **op_in, + int oa_ndim); static int npyiter_check_per_op_flags(npy_uint32 flags, char *op_itflags); static int @@ -293,7 +293,7 @@ npyiter_prepare_one_operand(PyArrayObject **op, npy_uint32 flags, npy_uint32 op_flags, char *op_itflags); static int -npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in, +npyiter_prepare_operands(int niter, PyArrayObject **op_in, PyArrayObject **op, char **op_dataptr, PyArray_Descr **op_request_dtypes, @@ -301,20 +301,20 @@ npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags, npy_uint32 *op_flags, char *op_itflags); static int -npyiter_check_casting(npy_intp niter, PyArrayObject **op, +npyiter_check_casting(int niter, PyArrayObject **op, PyArray_Descr **op_dtype, NPY_CASTING casting, char *op_itflags); static int npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags, char **op_dataptr, - npy_uint32 *op_flags, npy_intp **op_axes, + npy_uint32 *op_flags, int **op_axes, int output_scalars); static void -npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter, +npyiter_replace_axisdata(NpyIter *iter, int iiter, PyArrayObject *op, - npy_intp op_ndim, char *op_dataptr, - npy_intp *op_axes); + int op_ndim, char *op_dataptr, + int *op_axes); static void npyiter_compute_index_strides(NpyIter *iter, npy_uint32 flags); static void @@ -330,7 +330,7 @@ static void npyiter_coalesce_axes(NpyIter *iter); static PyArray_Descr * -npyiter_get_common_dtype(npy_intp niter, PyArrayObject **op, +npyiter_get_common_dtype(int niter, PyArrayObject **op, char *op_itflags, PyArray_Descr **op_dtype, PyArray_Descr **op_request_dtypes, int only_inputs, int output_scalars); @@ -338,16 +338,16 @@ npyiter_get_common_dtype(npy_intp niter, PyArrayObject **op, static PyArrayObject * npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype, npy_uint32 flags, char *op_itflags, - npy_intp op_ndim, npy_intp *shape, - PyArray_Descr *op_dtype, npy_intp *op_axes); + int op_ndim, npy_intp *shape, + PyArray_Descr *op_dtype, int *op_axes); static int npyiter_allocate_arrays(NpyIter *iter, npy_uint32 flags, PyArray_Descr **op_dtype, PyTypeObject *subtype, npy_uint32 *op_flags, char *op_itflags, - npy_intp **op_axes, int output_scalars); + int **op_axes, int output_scalars); static void -npyiter_get_priority_subtype(npy_intp niter, PyArrayObject **op, +npyiter_get_priority_subtype(int niter, PyArrayObject **op, char *op_itflags, double *subtype_priority, PyTypeObject **subtype); @@ -369,15 +369,15 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count, * Allocate a new iterator for multiple array objects */ NPY_NO_EXPORT NpyIter * -NpyIter_MultiNew(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags, +NpyIter_MultiNew(int niter, PyArrayObject **op_in, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32 *op_flags, PyArray_Descr **op_request_dtypes, - npy_intp oa_ndim, npy_intp **op_axes, npy_intp buffersize) + int oa_ndim, int **op_axes, npy_intp buffersize) { npy_uint32 itflags = NPY_ITFLAG_IDENTPERM; - npy_intp idim, ndim; - npy_intp iiter; + int idim, ndim; + int iiter; /* The iterator being constructed */ NpyIter *iter; @@ -768,7 +768,7 @@ NPY_NO_EXPORT NpyIter * NpyIter_New(PyArrayObject *op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, PyArray_Descr* dtype, - npy_intp a_ndim, npy_intp *axes, npy_intp buffersize) + int a_ndim, int *axes, npy_intp buffersize) { /* Split the flags into separate global and op flags */ npy_uint32 op_flags = flags&NPY_ITER_PER_OP_FLAGS; @@ -793,8 +793,8 @@ NPY_NO_EXPORT NpyIter * NpyIter_Copy(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); int out_of_memory = 0; npy_intp size; @@ -896,8 +896,8 @@ NPY_NO_EXPORT int NpyIter_Deallocate(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter, niter = NIT_NITER(iter); PyArray_Descr **dtype = NIT_DTYPES(iter); PyArrayObject **object = NIT_OPERANDS(iter); @@ -951,13 +951,13 @@ NpyIter_Deallocate(NpyIter *iter) * Returns NPY_SUCCEED or NPY_FAIL. */ NPY_NO_EXPORT int -NpyIter_RemoveAxis(NpyIter *iter, npy_intp axis) +NpyIter_RemoveAxis(NpyIter *iter, int axis) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); - npy_intp xdim = 0; + int xdim = 0; char *perm = NIT_PERM(iter); NpyIter_AxisData *axisdata_del = NIT_AXISDATA(iter), *axisdata; npy_intp sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, niter); @@ -1104,8 +1104,8 @@ NPY_NO_EXPORT int NpyIter_RemoveInnerLoop(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); /* Check conditions under which this can be done */ if (itflags&(NPY_ITFLAG_HASINDEX|NPY_ITFLAG_HASCOORDS)) { @@ -1154,8 +1154,8 @@ NPY_NO_EXPORT int NpyIter_Reset(NpyIter *iter, char **errmsg) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); if (itflags&NPY_ITFLAG_BUFFER) { NpyIter_BufferData *bufferdata; @@ -1206,8 +1206,8 @@ NPY_NO_EXPORT int NpyIter_ResetBasePointers(NpyIter *iter, char **baseptrs, char **errmsg) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter, niter = NIT_NITER(iter); char **resetdataptr = NIT_RESETDATAPTR(iter); npy_intp *baseoffsets = NIT_BASEOFFSETS(iter); @@ -1254,8 +1254,8 @@ NpyIter_ResetToIterIndexRange(NpyIter *iter, npy_intp istart, npy_intp iend, char **errmsg) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - /*npy_intp niter = NIT_NITER(iter);*/ + /*int ndim = NIT_NDIM(iter);*/ + /*int niter = NIT_NITER(iter);*/ if (!(itflags&NPY_ITFLAG_RANGE)) { if (errmsg == NULL) { @@ -1312,8 +1312,8 @@ NPY_NO_EXPORT int NpyIter_GotoCoords(NpyIter *iter, npy_intp *coords) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp iterindex, factor; NpyIter_AxisData *axisdata; @@ -1398,8 +1398,8 @@ NPY_NO_EXPORT int NpyIter_GotoIndex(NpyIter *iter, npy_intp index) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp iterindex, factor; NpyIter_AxisData *axisdata; @@ -1486,8 +1486,8 @@ NPY_NO_EXPORT int NpyIter_GotoIterIndex(NpyIter *iter, npy_intp iterindex) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter, niter = NIT_NITER(iter); if (itflags&NPY_ITFLAG_NOINNER) { PyErr_SetString(PyExc_ValueError, @@ -1550,8 +1550,8 @@ NPY_NO_EXPORT npy_intp NpyIter_GetIterIndex(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); /* iterindex is only used if NPY_ITER_RANGED or NPY_ITER_BUFFERED was set */ if (itflags&(NPY_ITFLAG_RANGE|NPY_ITFLAG_BUFFER)) { @@ -1603,12 +1603,12 @@ npyiter_iternext_itflags@tag_itflags@_dims@tag_ndim@_iters@tag_niter@( { const npy_uint32 itflags = @const_itflags@; #if @const_ndim@ >= NPY_MAXDIMS - npy_intp idim, ndim = NIT_NDIM(iter); + int idim, ndim = NIT_NDIM(iter); #endif #if @const_niter@ < NPY_MAXDIMS - const npy_intp niter = @const_niter@; + const int niter = @const_niter@; #else - npy_intp niter = NIT_NITER(iter); + int niter = NIT_NITER(iter); #endif npy_intp istrides, nstrides, sizeof_axisdata; @@ -1757,14 +1757,14 @@ static int npyiter_buffered_reduce_iternext_iters@tag_niter@(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ + /*int ndim = NIT_NDIM(iter);*/ #if @const_niter@ >= NPY_MAXDIMS - npy_intp niter = NIT_NITER(iter); + int niter = NIT_NITER(iter); #else - const npy_intp niter = @const_niter@; + const int niter = @const_niter@; #endif - npy_intp iiter; + int iiter; NpyIter_AxisData *axisdata; NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter); @@ -1838,8 +1838,8 @@ static int npyiter_buffered_iternext(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter); @@ -1850,7 +1850,8 @@ npyiter_buffered_iternext(NpyIter *iter) if (!(itflags&NPY_ITFLAG_NOINNER)) { /* Increment within the buffer */ if (++NIT_ITERINDEX(iter) < NBF_BUFITEREND(bufferdata)) { - npy_intp iiter, *strides; + int iiter; + npy_intp *strides; char **ptrs; strides = NBF_STRIDES(bufferdata); @@ -1907,8 +1908,8 @@ NPY_NO_EXPORT NpyIter_IterNext_Fn NpyIter_GetIterNext(NpyIter *iter, char **errmsg) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); /* * When there is just one iteration and buffering is disabled @@ -2036,10 +2037,10 @@ static void npyiter_getcoord_itflags@tag_itflags@(NpyIter *iter, npy_intp *outcoord) { const npy_uint32 itflags = @const_itflags@; - npy_intp ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); - npy_intp idim, sizeof_axisdata; + npy_intp sizeof_axisdata; NpyIter_AxisData *axisdata; #if !((@const_itflags@)&NPY_ITFLAG_IDENTPERM) char* perm = NIT_PERM(iter); @@ -2085,8 +2086,8 @@ NPY_NO_EXPORT NpyIter_GetCoords_Fn NpyIter_GetGetCoords(NpyIter *iter, char **errmsg) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); /* These flags must be correct */ if ((itflags&(NPY_ITFLAG_HASCOORDS|NPY_ITFLAG_DELAYBUF)) != @@ -2207,8 +2208,8 @@ NPY_NO_EXPORT npy_bool NpyIter_RequiresBuffering(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter, niter = NIT_NITER(iter); char *op_itflags; @@ -2242,7 +2243,7 @@ NpyIter_IterationNeedsAPI(NpyIter *iter) /*NUMPY_API * Gets the number of dimensions being iterated */ -NPY_NO_EXPORT npy_intp +NPY_NO_EXPORT int NpyIter_GetNDim(NpyIter *iter) { return NIT_NDIM(iter); @@ -2251,7 +2252,7 @@ NpyIter_GetNDim(NpyIter *iter) /*NUMPY_API * Gets the number of operands being iterated */ -NPY_NO_EXPORT npy_intp +NPY_NO_EXPORT int NpyIter_GetNIter(NpyIter *iter) { return NIT_NITER(iter); @@ -2269,7 +2270,7 @@ NpyIter_GetIterSize(NpyIter *iter) /*NUMPY_API * Whether the iterator is buffered */ -NPY_NO_EXPORT int +NPY_NO_EXPORT npy_bool NpyIter_IsBuffered(NpyIter *iter) { return (NIT_ITFLAGS(iter)&NPY_ITFLAG_BUFFER) != 0; @@ -2278,7 +2279,7 @@ NpyIter_IsBuffered(NpyIter *iter) /*NUMPY_API * Whether the inner loop can grow if buffering is unneeded */ -NPY_NO_EXPORT int +NPY_NO_EXPORT npy_bool NpyIter_IsGrowInner(NpyIter *iter) { return (NIT_ITFLAGS(iter)&NPY_ITFLAG_GROWINNER) != 0; @@ -2291,8 +2292,8 @@ NPY_NO_EXPORT npy_intp NpyIter_GetBufferSize(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); if (itflags&NPY_ITFLAG_BUFFER) { NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter); @@ -2333,10 +2334,10 @@ NPY_NO_EXPORT int NpyIter_GetShape(NpyIter *iter, npy_intp *outshape) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); - npy_intp idim, sizeof_axisdata; + int idim, sizeof_axisdata; NpyIter_AxisData *axisdata; char *perm; @@ -2397,8 +2398,8 @@ NpyIter_CreateCompatibleStrides(NpyIter *iter, npy_intp itemsize, npy_intp *outstrides) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp sizeof_axisdata; NpyIter_AxisData *axisdata; @@ -2444,8 +2445,8 @@ NPY_NO_EXPORT char ** NpyIter_GetDataPtrArray(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); if (itflags&NPY_ITFLAG_BUFFER) { NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter); @@ -2473,8 +2474,8 @@ NPY_NO_EXPORT char ** NpyIter_GetInitialDataPtrArray(NpyIter *iter) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); return NIT_RESETDATAPTR(iter); } @@ -2486,8 +2487,8 @@ NPY_NO_EXPORT PyArray_Descr ** NpyIter_GetDescrArray(NpyIter *iter) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - /*npy_intp ndim = NIT_NDIM(iter);*/ - /*npy_intp niter = NIT_NITER(iter);*/ + /*int ndim = NIT_NDIM(iter);*/ + /*int niter = NIT_NITER(iter);*/ return NIT_DTYPES(iter); } @@ -2499,8 +2500,8 @@ NPY_NO_EXPORT PyArrayObject ** NpyIter_GetOperandArray(NpyIter *iter) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); return NIT_OPERANDS(iter); } @@ -2512,8 +2513,8 @@ NPY_NO_EXPORT PyArrayObject * NpyIter_GetIterView(NpyIter *iter, npy_intp i) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp shape[NPY_MAXDIMS], strides[NPY_MAXDIMS]; PyArrayObject *obj, *view; @@ -2573,8 +2574,8 @@ NPY_NO_EXPORT npy_intp * NpyIter_GetIndexPtr(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); NpyIter_AxisData *axisdata = NIT_AXISDATA(iter); @@ -2594,8 +2595,8 @@ NPY_NO_EXPORT void NpyIter_GetReadFlags(NpyIter *iter, char *outreadflags) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter, niter = NIT_NITER(iter); char *op_itflags = NIT_OPITFLAGS(iter); @@ -2611,8 +2612,8 @@ NPY_NO_EXPORT void NpyIter_GetWriteFlags(NpyIter *iter, char *outwriteflags) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter, niter = NIT_NITER(iter); char *op_itflags = NIT_OPITFLAGS(iter); @@ -2631,8 +2632,8 @@ NPY_NO_EXPORT npy_intp * NpyIter_GetInnerStrideArray(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); if (itflags&NPY_ITFLAG_BUFFER) { NpyIter_BufferData *data = NIT_BUFFERDATA(iter); @@ -2653,11 +2654,11 @@ NpyIter_GetInnerStrideArray(NpyIter *iter) * Returns NULL if an error occurs. */ NPY_NO_EXPORT npy_intp * -NpyIter_GetAxisStrideArray(NpyIter *iter, npy_intp axis) +NpyIter_GetAxisStrideArray(NpyIter *iter, int axis) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); char *perm = NIT_PERM(iter); NpyIter_AxisData *axisdata = NIT_AXISDATA(iter); @@ -2702,8 +2703,8 @@ NPY_NO_EXPORT void NpyIter_GetInnerFixedStrideArray(NpyIter *iter, npy_intp *out_strides) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); NpyIter_AxisData *axisdata0 = NIT_AXISDATA(iter); npy_intp sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, niter); @@ -2737,7 +2738,7 @@ NpyIter_GetInnerFixedStrideArray(NpyIter *iter, npy_intp *out_strides) */ else { NpyIter_AxisData *axisdata = axisdata0; - npy_intp idim, + int idim, reduce_outerdim = NBF_REDUCE_OUTERDIM(data); for (idim = 0; idim < reduce_outerdim; ++idim) { if (NAD_STRIDES(axisdata)[iiter] != 0) { @@ -2786,8 +2787,8 @@ NPY_NO_EXPORT npy_intp * NpyIter_GetInnerLoopSizePtr(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int niter = NIT_NITER(iter); if (itflags&NPY_ITFLAG_BUFFER) { NpyIter_BufferData *data = NIT_BUFFERDATA(iter); @@ -2869,9 +2870,9 @@ npyiter_check_global_flags(npy_uint32 flags, npy_uint32* itflags) return 1; } -static npy_intp -npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in, - npy_intp oa_ndim) +static int +npyiter_calculate_ndim(int niter, PyArrayObject **op_in, + int oa_ndim) { /* If 'op_axes' is being used, force 'ndim' */ if (oa_ndim > 0 ) { @@ -2879,11 +2880,11 @@ npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in, } /* Otherwise it's the maximum 'ndim' from the operands */ else { - npy_intp ndim = 0, iiter; + int ndim = 0, iiter; for (iiter = 0; iiter < niter; ++iiter) { if (op_in[iiter] != NULL) { - npy_intp ondim = PyArray_NDIM(op_in[iiter]); + int ondim = PyArray_NDIM(op_in[iiter]); if (ondim > ndim) { ndim = ondim; } @@ -2896,10 +2897,10 @@ npyiter_calculate_ndim(npy_intp niter, PyArrayObject **op_in, } static int -npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes) +npyiter_check_op_axes(int niter, int oa_ndim, int **op_axes) { char axes_dupcheck[NPY_MAXDIMS]; - npy_intp iiter, idim; + int iiter, idim; if (oa_ndim == 0 && op_axes != NULL) { PyErr_Format(PyExc_ValueError, @@ -2912,7 +2913,7 @@ npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes) PyErr_Format(PyExc_ValueError, "Cannot construct an iterator with more than %d dimensions " "(%d were requested for op_axes)", - (int)NPY_MAXDIMS, (int)oa_ndim); + (int)NPY_MAXDIMS, oa_ndim); return 0; } else if (op_axes == NULL) { @@ -2924,7 +2925,7 @@ npyiter_check_op_axes(npy_intp niter, npy_intp oa_ndim, npy_intp **op_axes) /* Check that there are no duplicates in op_axes */ for (iiter = 0; iiter < niter; ++iiter) { - npy_intp *axes = op_axes[iiter]; + int *axes = op_axes[iiter]; if (axes != NULL) { memset(axes_dupcheck, 0, NPY_MAXDIMS); for (idim = 0; idim < oa_ndim; ++idim) { @@ -3204,7 +3205,7 @@ npyiter_prepare_one_operand(PyArrayObject **op, * can replace the arrays if copying is necessary. */ static int -npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in, +npyiter_prepare_operands(int niter, PyArrayObject **op_in, PyArrayObject **op, char **op_dataptr, PyArray_Descr **op_request_dtypes, @@ -3212,7 +3213,7 @@ npyiter_prepare_operands(npy_intp niter, PyArrayObject **op_in, npy_uint32 flags, npy_uint32 *op_flags, char *op_itflags) { - npy_intp iiter, i; + int iiter, i; for (iiter = 0; iiter < niter; ++iiter) { op[iiter] = op_in[iiter]; @@ -3290,12 +3291,12 @@ npyiter_casting_to_string(NPY_CASTING casting) } static int -npyiter_check_casting(npy_intp niter, PyArrayObject **op, +npyiter_check_casting(int niter, PyArrayObject **op, PyArray_Descr **op_dtype, NPY_CASTING casting, char *op_itflags) { - npy_intp iiter; + int iiter; for(iiter = 0; iiter < niter; ++iiter) { NPY_IT_DBG_PRINTF("Iterator: Checking casting for operand %d\n", @@ -3412,14 +3413,14 @@ npyiter_shape_string(npy_intp n, npy_intp *vals, char *ending) static int npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags, char **op_dataptr, - npy_uint32 *op_flags, npy_intp **op_axes, + npy_uint32 *op_flags, int **op_axes, int output_scalars) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); - npy_intp ondim; + int ondim; NpyIter_AxisData *axisdata; npy_intp sizeof_axisdata; PyArrayObject **op = NIT_OPERANDS(iter), *op_cur; @@ -3458,9 +3459,9 @@ npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags, } } else { - npy_intp *axes = op_axes[iiter]; + int *axes = op_axes[iiter]; for (idim = 0; idim < ndim; ++idim) { - npy_intp i = axes[idim]; + int i = axes[idim]; if (i >= 0) { if (i < ondim) { npy_intp bshape = broadcast_shape[idim], @@ -3546,8 +3547,8 @@ npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, char *op_itflags, } } else { - npy_intp *axes = op_axes[iiter]; - npy_intp i = axes[ndim-idim-1]; + int *axes = op_axes[iiter]; + int i = axes[ndim-idim-1]; if (i >= 0) { if (bshape == 1 || op_cur == NULL) { strides[iiter] = 0; @@ -3651,7 +3652,7 @@ broadcast_error: { "[original->remapped]: "); for (iiter = 0; iiter < niter; ++iiter) { if (op[iiter] != NULL) { - npy_intp *axes = op_axes[iiter]; + int *axes = op_axes[iiter]; tmpstr = (axes == NULL) ? " " : "->"; tmp = npyiter_shape_string(PyArray_NDIM(op[iiter]), @@ -3722,7 +3723,7 @@ operand_different_than_broadcast: { } /* Remapped operand shape */ if (op_axes != NULL && op_axes[iiter] != NULL) { - npy_intp *axes = op_axes[iiter]; + int *axes = op_axes[iiter]; for (idim = 0; idim < ndim; ++idim) { npy_intp i = axes[ndim-idim-1]; @@ -3797,14 +3798,14 @@ operand_different_than_broadcast: { * array. */ static void -npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter, +npyiter_replace_axisdata(NpyIter *iter, int iiter, PyArrayObject *op, - npy_intp op_ndim, char *op_dataptr, - npy_intp *op_axes) + int op_ndim, char *op_dataptr, + int *op_axes) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); NpyIter_AxisData *axisdata0, *axisdata; npy_intp sizeof_axisdata; @@ -3824,7 +3825,8 @@ npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter, if (op_axes != NULL) { for (idim = 0; idim < ndim; ++idim, NIT_ADVANCE_AXISDATA(axisdata, 1)) { char p; - npy_intp i, shape; + int i; + npy_intp shape; /* Apply the perm to get the original axis */ p = perm[idim]; @@ -3835,7 +3837,7 @@ npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter, i = op_axes[ndim-p-1]; } - if ((npy_uintp)i < (npy_uintp)op_ndim) { + if ((unsigned int)i < (unsigned int)op_ndim) { shape = PyArray_DIM(op, i); if (shape != 1) { npy_intp stride = PyArray_STRIDE(op, i); @@ -3854,7 +3856,8 @@ npyiter_replace_axisdata(NpyIter *iter, npy_intp iiter, else { for (idim = 0; idim < ndim; ++idim, NIT_ADVANCE_AXISDATA(axisdata, 1)) { char p; - npy_intp i, shape; + int i; + npy_intp shape; /* Apply the perm to get the original axis */ p = perm[idim]; @@ -3904,8 +3907,8 @@ static void npyiter_compute_index_strides(NpyIter *iter, npy_uint32 flags) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp indexstride; NpyIter_AxisData *axisdata; @@ -3969,8 +3972,8 @@ static void npyiter_apply_forced_iteration_order(NpyIter *iter, NPY_ORDER order) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - npy_intp ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); switch (order) { case NPY_CORDER: @@ -4020,8 +4023,8 @@ static void npyiter_flip_negative_strides(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); npy_intp istrides, nstrides = NAD_NSTRIDES(); NpyIter_AxisData *axisdata, *axisdata0; @@ -4099,8 +4102,8 @@ static void npyiter_reverse_axis_ordering(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp i, temp, size; npy_intp *first, *last; @@ -4139,8 +4142,8 @@ static void npyiter_find_best_axis_ordering(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); npy_intp ax_i0, ax_i1, ax_ipos; char ax_j0, ax_j1; @@ -4279,8 +4282,8 @@ static void npyiter_coalesce_axes(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); npy_intp istrides, nstrides = NAD_NSTRIDES(); NpyIter_AxisData *axisdata = NIT_AXISDATA(iter); @@ -4360,12 +4363,12 @@ npyiter_coalesce_axes(NpyIter *iter) static PyArrayObject * npyiter_new_temp_array(NpyIter *iter, PyTypeObject *subtype, npy_uint32 flags, char *op_itflags, - npy_intp op_ndim, npy_intp *shape, - PyArray_Descr *op_dtype, npy_intp *op_axes) + int op_ndim, npy_intp *shape, + PyArray_Descr *op_dtype, int *op_axes) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); char *perm = NIT_PERM(iter); npy_intp new_shape[NPY_MAXDIMS], strides[NPY_MAXDIMS], @@ -4633,11 +4636,11 @@ npyiter_allocate_arrays(NpyIter *iter, npy_uint32 flags, PyArray_Descr **op_dtype, PyTypeObject *subtype, npy_uint32 *op_flags, char *op_itflags, - npy_intp **op_axes, int output_scalars) + int **op_axes, int output_scalars) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); NpyIter_BufferData *bufferdata = NULL; PyArrayObject **op = NIT_OPERANDS(iter); @@ -4652,7 +4655,7 @@ npyiter_allocate_arrays(NpyIter *iter, if (op[iiter] == NULL) { PyArrayObject *out; PyTypeObject *op_subtype; - npy_intp ondim = output_scalars ? 0 : ndim; + int ondim = output_scalars ? 0 : ndim; /* Check whether the subtype was disabled */ op_subtype = (op_flags[iiter]&NPY_ITER_NO_SUBTYPE) ? @@ -4729,7 +4732,7 @@ npyiter_allocate_arrays(NpyIter *iter, else if ((op_itflags[iiter]&NPY_OP_ITFLAG_CAST) && (op_flags[iiter]&(NPY_ITER_COPY|NPY_ITER_UPDATEIFCOPY))) { PyArrayObject *temp; - npy_intp ondim = PyArray_NDIM(op[iiter]); + int ondim = PyArray_NDIM(op[iiter]); /* Allocate the temporary array, if possible */ temp = npyiter_new_temp_array(iter, &PyArray_Type, @@ -4878,12 +4881,12 @@ npyiter_allocate_arrays(NpyIter *iter, * subtype of the input array with highest priority. */ static void -npyiter_get_priority_subtype(npy_intp niter, PyArrayObject **op, +npyiter_get_priority_subtype(int niter, PyArrayObject **op, char *op_itflags, double *subtype_priority, PyTypeObject **subtype) { - npy_intp iiter; + int iiter; for (iiter = 0; iiter < niter; ++iiter) { if (op[iiter] != NULL && op_itflags[iiter]&NPY_OP_ITFLAG_READ) { @@ -4902,12 +4905,12 @@ npyiter_get_priority_subtype(npy_intp niter, PyArrayObject **op, * are not read from out of the calculation. */ static PyArray_Descr * -npyiter_get_common_dtype(npy_intp niter, PyArrayObject **op, +npyiter_get_common_dtype(int niter, PyArrayObject **op, char *op_itflags, PyArray_Descr **op_dtype, PyArray_Descr **op_request_dtypes, int only_inputs, int output_scalars) { - npy_intp iiter; + int iiter; npy_intp narrs = 0, ndtypes = 0; PyArrayObject *arrs[NPY_MAXARGS]; PyArray_Descr *dtypes[NPY_MAXARGS]; @@ -4961,8 +4964,8 @@ static int npyiter_allocate_transfer_functions(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter = 0, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter = 0, niter = NIT_NITER(iter); npy_intp i; char *op_itflags = NIT_OPITFLAGS(iter); @@ -5093,8 +5096,8 @@ static int npyiter_allocate_buffers(NpyIter *iter, char **errmsg) { /*npy_uint32 itflags = NIT_ITFLAGS(iter);*/ - /*npy_intp ndim = NIT_NDIM(iter);*/ - npy_intp iiter = 0, niter = NIT_NITER(iter); + /*int ndim = NIT_NDIM(iter);*/ + int iiter = 0, niter = NIT_NITER(iter); npy_intp i; char *op_itflags = NIT_OPITFLAGS(iter); @@ -5147,8 +5150,8 @@ static void npyiter_goto_iterindex(NpyIter *iter, npy_intp iterindex) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int niter = NIT_NITER(iter); char **dataptr; NpyIter_AxisData *axisdata; @@ -5230,8 +5233,8 @@ static void npyiter_copy_from_buffers(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); char *op_itflags = NIT_OPITFLAGS(iter); NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter); @@ -5288,7 +5291,7 @@ npyiter_copy_from_buffers(NpyIter *iter) npy_intp op_transfersize; npy_intp src_stride, *dst_strides, *dst_coords, *dst_shape; - npy_intp ndim_transfer; + int ndim_transfer; NPY_IT_DBG_PRINTF("Iterator: Operand %d was buffered\n", (int)iiter); @@ -5398,8 +5401,8 @@ static void npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); char *op_itflags = NIT_OPITFLAGS(iter); NpyIter_BufferData *bufferdata = NIT_BUFFERDATA(iter); @@ -5712,7 +5715,7 @@ npyiter_copy_to_buffers(NpyIter *iter, char **prev_dataptrs) npy_intp op_transfersize; npy_intp dst_stride, *src_strides, *src_coords, *src_shape; - npy_intp ndim_transfer; + int ndim_transfer; npy_bool skip_transfer = 0; @@ -5882,8 +5885,8 @@ npyiter_checkreducesize(NpyIter *iter, npy_intp count, npy_intp *reduce_outerdim) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); NpyIter_AxisData *axisdata; npy_intp sizeof_axisdata; @@ -6063,8 +6066,8 @@ NPY_NO_EXPORT void NpyIter_DebugPrint(NpyIter *iter) { npy_uint32 itflags = NIT_ITFLAGS(iter); - npy_intp idim, ndim = NIT_NDIM(iter); - npy_intp iiter, niter = NIT_NITER(iter); + int idim, ndim = NIT_NDIM(iter); + int iiter, niter = NIT_NITER(iter); NpyIter_AxisData *axisdata; npy_intp sizeof_axisdata; diff --git a/numpy/core/src/multiarray/new_iterator_pywrap.c b/numpy/core/src/multiarray/new_iterator_pywrap.c index eff0263eb..c67100ece 100644 --- a/numpy/core/src/multiarray/new_iterator_pywrap.c +++ b/numpy/core/src/multiarray/new_iterator_pywrap.c @@ -547,10 +547,10 @@ try_single_dtype: static int npyiter_convert_op_axes(PyObject *op_axes_in, npy_intp niter, - npy_intp **op_axes, npy_intp *oa_ndim) + int **op_axes, int *oa_ndim) { PyObject *a; - npy_intp iiter; + int iiter; if ((!PyTuple_Check(op_axes_in) && !PyList_Check(op_axes_in)) || PySequence_Size(op_axes_in) != niter) { @@ -563,7 +563,7 @@ npyiter_convert_op_axes(PyObject *op_axes_in, npy_intp niter, /* Copy the tuples into op_axes */ for (iiter = 0; iiter < niter; ++iiter) { - npy_intp idim; + int idim; a = PySequence_GetItem(op_axes_in, iiter); if (a == NULL) { return 0; @@ -640,9 +640,9 @@ npyiter_convert_op_axes(PyObject *op_axes_in, npy_intp niter, static int npyiter_convert_ops(PyObject *op_in, PyObject *op_flags_in, PyArrayObject **op, npy_uint32 *op_flags, - npy_intp *niter_out) + int *niter_out) { - npy_intp iiter, niter; + int iiter, niter; /* niter and op */ if (PyTuple_Check(op_in) || PyList_Check(op_in)) { @@ -749,16 +749,16 @@ npyiter_init(NewNpyArrayIterObject *self, PyObject *args, PyObject *kwds) PyObject *op_in = NULL, *op_flags_in = NULL, *op_dtypes_in = NULL, *op_axes_in = NULL; - npy_intp iiter, niter = 0; + int iiter, niter = 0; PyArrayObject *op[NPY_MAXARGS]; npy_uint32 flags = 0; NPY_ORDER order = NPY_KEEPORDER; NPY_CASTING casting = NPY_SAFE_CASTING; npy_uint32 op_flags[NPY_MAXARGS]; PyArray_Descr *op_request_dtypes[NPY_MAXARGS]; - npy_intp oa_ndim = 0; - npy_intp op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS]; - npy_intp *op_axes[NPY_MAXARGS]; + int oa_ndim = 0; + int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS]; + int *op_axes[NPY_MAXARGS]; int buffersize = 0; if (self->iter != NULL) { @@ -857,7 +857,7 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self), PyObject *op_in = NULL, *axes_in = NULL, *op_flags_in = NULL, *op_dtypes_in = NULL; - npy_intp iiter, niter = 0, inest, nnest = 0; + int iiter, niter = 0, inest, nnest = 0; PyArrayObject *op[NPY_MAXARGS]; npy_uint32 flags = 0, flags_inner = 0; NPY_ORDER order = NPY_KEEPORDER; @@ -865,10 +865,10 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self), npy_uint32 op_flags[NPY_MAXARGS], op_flags_inner[NPY_MAXARGS]; PyArray_Descr *op_request_dtypes[NPY_MAXARGS], *op_request_dtypes_inner[NPY_MAXARGS]; - npy_intp op_axes_data[NPY_MAXDIMS]; - npy_intp *nested_op_axes[NPY_MAXDIMS]; - npy_intp nested_naxes[NPY_MAXDIMS], iaxes, naxes; - npy_intp negones[NPY_MAXDIMS]; + int op_axes_data[NPY_MAXDIMS]; + int *nested_op_axes[NPY_MAXDIMS]; + int nested_naxes[NPY_MAXDIMS], iaxes, naxes; + int negones[NPY_MAXDIMS]; char used_axes[NPY_MAXDIMS]; int buffersize = 0; @@ -1019,7 +1019,7 @@ NpyIter_NestedIters(PyObject *NPY_UNUSED(self), for (inest = 0; inest < nnest; ++inest) { NewNpyArrayIterObject *iter; - npy_intp *op_axes_niter[NPY_MAXARGS]; + int *op_axes_niter[NPY_MAXARGS]; /* * All the operands' op_axes are the same, except for diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index 07a308e66..59787185a 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -2047,8 +2047,8 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self, PyObject *args, PyObject *kwds, PyArrayObject **op) { - npy_intp nin, nout; - npy_intp i, idim, niter; + int nin, nout; + int i, idim, niter; char *ufunc_name; int retval = -1, any_object = 0; NPY_CASTING input_casting; @@ -2056,9 +2056,9 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self, PyArray_Descr *dtype[NPY_MAXARGS]; /* Use remapped axes for generalized ufunc */ - npy_intp broadcast_ndim, op_ndim; - npy_intp op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS]; - npy_intp *op_axes[NPY_MAXARGS]; + int broadcast_ndim, op_ndim; + int op_axes_arrays[NPY_MAXARGS][NPY_MAXDIMS]; + int *op_axes[NPY_MAXARGS]; npy_uint32 op_flags[NPY_MAXARGS]; @@ -2133,7 +2133,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self, /* Figure out the number of dimensions needed by the iterator */ broadcast_ndim = 0; for (i = 0; i < nin; ++i) { - npy_intp n = PyArray_NDIM(op[i]) - self->core_num_dims[i]; + int n = PyArray_NDIM(op[i]) - self->core_num_dims[i]; if (n > broadcast_ndim) { broadcast_ndim = n; } @@ -2151,7 +2151,7 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *self, core_dim_ixs_size = 0; core_dim_ixs = self->core_dim_ixs; for (i = 0; i < niter; ++i) { - npy_intp n; + int n; if (op[i]) { /* * Note that n may be negative if broadcasting @@ -2463,8 +2463,8 @@ PyUFunc_GenericFunction(PyUFuncObject *self, PyObject *args, PyObject *kwds, PyArrayObject **op) { - npy_intp nin, nout; - npy_intp i, niter; + int nin, nout; + int i, niter; char *ufunc_name; int retval = -1, any_object = 0; NPY_CASTING input_casting; @@ -2788,8 +2788,8 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr, { PyArrayObject *op[2]; PyArray_Descr *op_dtypes[2] = {NULL, NULL}; - npy_intp op_axes_arrays[2][NPY_MAXDIMS]; - npy_intp *op_axes[2] = {op_axes_arrays[0], op_axes_arrays[1]}; + int op_axes_arrays[2][NPY_MAXDIMS]; + int *op_axes[2] = {op_axes_arrays[0], op_axes_arrays[1]}; npy_uint32 op_flags[2]; int i, idim, ndim, otype_final; int needs_api, need_outer_iterator; @@ -2893,7 +2893,7 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr, } if (need_outer_iterator) { - npy_intp ndim_iter = 0; + int ndim_iter = 0; npy_uint32 flags = NPY_ITER_ZEROSIZE_OK| NPY_ITER_REFS_OK; PyArray_Descr **op_dtypes_param = NULL; @@ -3420,8 +3420,8 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, { PyArrayObject *op[3]; PyArray_Descr *op_dtypes[3] = {NULL, NULL, NULL}; - npy_intp op_axes_arrays[3][NPY_MAXDIMS]; - npy_intp *op_axes[3] = {op_axes_arrays[0], op_axes_arrays[1], + int op_axes_arrays[3][NPY_MAXDIMS]; + int *op_axes[3] = {op_axes_arrays[0], op_axes_arrays[1], op_axes_arrays[2]}; npy_uint32 op_flags[3]; int i, idim, ndim, otype_final; |