diff options
author | Marco Aurelio da Costa <costa@gamic.com> | 2021-06-08 13:14:49 -0300 |
---|---|---|
committer | Marco Aurelio da Costa <costa@gamic.com> | 2021-06-08 13:14:49 -0300 |
commit | 4ada386d9f7624b87356bb11646d44e2f58657c9 (patch) | |
tree | 1096aecaa740f8104695910fc53503926628e02b /doc/source/reference/c-api | |
parent | b9a63f5052b0ba5a7a5b2616ddcc1754df177bd3 (diff) | |
download | numpy-4ada386d9f7624b87356bb11646d44e2f58657c9.tar.gz |
DOC: NeighborhoodIterator position on creation
Document that NeighborhoodIterator will point to the begining
of the data instead of the position pointed by iter on creation
in the special case where data is contiguous.
Diffstat (limited to 'doc/source/reference/c-api')
-rw-r--r-- | doc/source/reference/c-api/array.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index 1673f1d6b..cb2f4b645 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -2647,6 +2647,12 @@ cost of a slight overhead. - If the position of iter is changed, any subsequent call to PyArrayNeighborhoodIter_Next is undefined behavior, and PyArrayNeighborhoodIter_Reset must be called. + - If the position of iter is not the beginning of the data and the + underlying data for iter is contiguous, the iterator will point to the + start of the data instead of position pointed by iter. + To avoid this situation, iter should be moved to the required position + only after the creation of iterator, and PyArrayNeighborhoodIter_Reset + must be called. .. code-block:: c @@ -2656,7 +2662,7 @@ cost of a slight overhead. /*For a 3x3 kernel */ bounds = {-1, 1, -1, 1}; - neigh_iter = (PyArrayNeighborhoodIterObject*)PyArrayNeighborhoodIter_New( + neigh_iter = (PyArrayNeighborhoodIterObject*)PyArray_NeighborhoodIterNew( iter, bounds, NPY_NEIGHBORHOOD_ITER_ZERO_PADDING, NULL); for(i = 0; i < iter->size; ++i) { |