MCPcopy Create free account
hub / github.com/numpy/numpy / PyArray_GetPtr

Function PyArray_GetPtr

numpy/core/src/multiarray/multiarraymodule.c:218–229  ·  view source on GitHub ↗

NUMPY_API * Produce a pointer into array */

Source from the content-addressed store, hash-verified

216 * Produce a pointer into array
217 */
218NPY_NO_EXPORT void *
219PyArray_GetPtr(PyArrayObject *obj, npy_intp const* ind)
220{
221 int n = PyArray_NDIM(obj);
222 npy_intp *strides = PyArray_STRIDES(obj);
223 char *dptr = PyArray_DATA(obj);
224
225 while (n--) {
226 dptr += (*strides++) * (*ind++);
227 }
228 return (void *)dptr;
229}
230
231/*NUMPY_API
232 * Compare Lists

Callers

nothing calls this directly

Calls 3

PyArray_NDIMFunction · 0.85
PyArray_STRIDESFunction · 0.85
PyArray_DATAFunction · 0.85

Tested by

no test coverage detected