diff options
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/include/numpy/ndarraytypes.h | 2 | ||||
| -rw-r--r-- | numpy/core/src/multiarray/_multiarray_tests.c.src | 15 | ||||
| -rw-r--r-- | numpy/core/src/multiarray/iterators.c | 3 | ||||
| -rw-r--r-- | numpy/core/tests/test_multiarray.py | 7 |
4 files changed, 3 insertions, 24 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index 0f24d814f..dacb72022 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -1225,8 +1225,6 @@ struct PyArrayIterObject_tag { _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \ for (__npy_i = 0; __npy_i<=_PyAIT(it)->nd_m1; \ __npy_i++) { \ - _PyAIT(it)->coordinates[__npy_i] = \ - (__npy_ind / _PyAIT(it)->factors[__npy_i]); \ _PyAIT(it)->dataptr += \ (__npy_ind / _PyAIT(it)->factors[__npy_i]) \ * _PyAIT(it)->strides[__npy_i]; \ diff --git a/numpy/core/src/multiarray/_multiarray_tests.c.src b/numpy/core/src/multiarray/_multiarray_tests.c.src index a63d91e59..ba10573d9 100644 --- a/numpy/core/src/multiarray/_multiarray_tests.c.src +++ b/numpy/core/src/multiarray/_multiarray_tests.c.src @@ -87,7 +87,7 @@ static int copy_@name@(PyArrayIterObject *itx, PyArrayNeighborhoodIterObject *ni * For each point in itx, copy the current neighborhood into an array which * is appended at the output list */ - for (i = itx->index; i < itx->size; ++i) { + for (i = 0; i < itx->size; ++i) { PyArrayNeighborhoodIter_Reset(niterx); for (j = 0; j < PyArray_NDIM(itx->ao); ++j) { @@ -130,7 +130,7 @@ static int copy_object(PyArrayIterObject *itx, PyArrayNeighborhoodIterObject *ni * For each point in itx, copy the current neighborhood into an array which * is appended at the output list */ - for (i = itx->index; i < itx->size; ++i) { + for (i = 0; i < itx->size; ++i) { PyArrayNeighborhoodIter_Reset(niterx); for (j = 0; j < PyArray_NDIM(itx->ao); ++j) { @@ -161,11 +161,10 @@ test_neighborhood_iterator(PyObject* NPY_UNUSED(self), PyObject* args) PyArrayObject *ax, *afill; PyArrayIterObject *itx; int i, typenum, mode, st; - Py_ssize_t idxstart = 0; npy_intp bounds[NPY_MAXDIMS*2]; PyArrayNeighborhoodIterObject *niterx; - if (!PyArg_ParseTuple(args, "OOOi|n", &x, &b, &fill, &mode, &idxstart)) { + if (!PyArg_ParseTuple(args, "OOOi", &x, &b, &fill, &mode)) { return NULL; } @@ -225,14 +224,6 @@ test_neighborhood_iterator(PyObject* NPY_UNUSED(self), PyObject* args) } } - if (idxstart >= itx->size || idxstart < 0) { - PyErr_SetString(PyExc_ValueError, - "start index not compatible with x input"); - goto clean_itx; - } - - PyArray_ITER_GOTO1D((PyArrayIterObject*)itx, idxstart); - niterx = (PyArrayNeighborhoodIterObject*)PyArray_NeighborhoodIterNew( (PyArrayIterObject*)itx, bounds, mode, afill); if (niterx == NULL) { diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c index 4a42d742e..3ebd4c858 100644 --- a/numpy/core/src/multiarray/iterators.c +++ b/numpy/core/src/multiarray/iterators.c @@ -1772,9 +1772,6 @@ PyArray_NeighborhoodIterNew(PyArrayIterObject *x, const npy_intp *bounds, */ x->contiguous = 0; - /* update the coordinates if x was contiguous before */ - PyArray_ITER_GOTO1D(x, x->index); - PyArrayNeighborhoodIter_Reset(ret); return (PyObject*)ret; diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 6df5e8467..5c91cb9ea 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -6946,13 +6946,6 @@ class TestNeighborhoodIter: x, [-1, 0, -1, 1], 4, NEIGH_MODE['constant']) assert_array_equal(l, r) - # Test with start in the middle - r = [np.array([[4, 0, 1], [4, 2, 3]], dtype=dt), - np.array([[0, 1, 4], [2, 3, 4]], dtype=dt)] - l = _multiarray_tests.test_neighborhood_iterator( - x, [-1, 0, -1, 1], 4, NEIGH_MODE['constant'], 2) - assert_array_equal(l, r) - def test_mirror2d(self, dt): x = np.array([[0, 1], [2, 3]], dtype=dt) r = [np.array([[0, 0, 1], [0, 0, 1]], dtype=dt), |
