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

Function PyArray_CheckStrides

numpy/core/src/multiarray/arrayobject.c:1123–1145  ·  view source on GitHub ↗

NUMPY_API*/

Source from the content-addressed store, hash-verified

1121
1122/*NUMPY_API*/
1123NPY_NO_EXPORT npy_bool
1124PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp offset,
1125 npy_intp const *dims, npy_intp const *newstrides)
1126{
1127 npy_intp begin, end;
1128 npy_intp lower_offset;
1129 npy_intp upper_offset;
1130
1131 if (numbytes == 0) {
1132 numbytes = PyArray_MultiplyList(dims, nd) * elsize;
1133 }
1134
1135 begin = -offset;
1136 end = numbytes - offset;
1137
1138 offset_bounds_from_strides(elsize, nd, dims, newstrides,
1139 &lower_offset, &upper_offset);
1140
1141 if ((upper_offset > end) || (lower_offset < begin)) {
1142 return NPY_FALSE;
1143 }
1144 return NPY_TRUE;
1145}
1146
1147
1148static PyObject *

Callers 2

array_strides_setFunction · 0.85
array_newFunction · 0.85

Calls 2

PyArray_MultiplyListFunction · 0.85

Tested by

no test coverage detected