Numpy Elementwise Iterator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************** Element-wise Array Iterator ***********************/ | |
/* Aided by Peter J. Verveer's nd_image package and numpy's arraymap ****/ | |
/* and Python's array iterator ***/ | |
/* get the dataptr from its current coordinates for simple iterator */ | |
static char* | |
get_ptr_simple(PyArrayIterObject* iter, npy_intp *coordinates) | |
{ | |
npy_intp i; | |
char *ret; | |
ret = PyArray_DATA(iter->ao); | |
for(i = 0; i < PyArray_NDIM(iter->ao); ++i) { | |
ret += coordinates[i] * iter->strides[i]; | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment