summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-08-07 13:19:16 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-08-07 13:19:16 +0000
commitf13d666f5f00dca9d1c3b51922119208dcee110c (patch)
treec4ef389fe255973530f99bc05310cbda7ddf931b /numpy
parentb80758ff9830ee7bebbbbe23c60a8dd31c8dabfb (diff)
downloadnumpy-f13d666f5f00dca9d1c3b51922119208dcee110c.tar.gz
Make bounds a member of the base struct PyArrayIterObject.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/include/numpy/ndarrayobject.h6
-rw-r--r--numpy/core/src/multiarray/iterators.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h
index 31e69fb6d..c3c5e7cb7 100644
--- a/numpy/core/include/numpy/ndarrayobject.h
+++ b/numpy/core/include/numpy/ndarrayobject.h
@@ -696,6 +696,8 @@ struct PyArrayIterObject_tag {
PyArrayObject *ao;
char *dataptr; /* pointer to current item*/
npy_bool contiguous;
+
+ npy_intp bounds[NPY_MAXDIMS][2];
npy_iter_get_dataptr_t translate;
} ;
@@ -945,6 +947,8 @@ typedef struct {
PyArrayObject *ao;
char *dataptr; /* pointer to current item*/
npy_bool contiguous;
+
+ npy_intp bounds[NPY_MAXDIMS][2];
npy_iter_get_dataptr_t translate;
/*
@@ -954,8 +958,6 @@ typedef struct {
/* Dimensions is the dimension of the array */
npy_intp dimensions[NPY_MAXDIMS];
- /* Bounds of the neighborhood to iterate over */
- npy_intp bounds[NPY_MAXDIMS][2];
/* Neighborhood points coordinates are computed relatively to the point pointed
* by _internal_iter */
diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
index 9d3921012..d0213d38e 100644
--- a/numpy/core/src/multiarray/iterators.c
+++ b/numpy/core/src/multiarray/iterators.c
@@ -297,7 +297,13 @@ array_iter_base_init(PyArrayIterObject *it, PyArrayObject *ao)
if (i > 0) {
it->factors[nd-i-1] = it->factors[nd-i] * ao->dimensions[nd-i];
}
+ it->bounds[i][0] = 0;
+ it->bounds[i][1] = ao->dimensions[i] - 1;
}
+
+ /* Not used for basic iterator: set to NULL to cause a segfault right away
+ * if misused */
+ it->translate = NULL;
PyArray_ITER_RESET(it);
return (PyObject *)it;