numpy
2.0.0
|
Go to the source code of this file.
Typedefs | |
typedef int( | PyArray_AssignReduceIdentityFunc )(PyArrayObject *result, void *data) |
typedef int( | PyArray_ReduceLoopFunc )(NpyIter *iter, char **dataptr, npy_intp *strideptr, npy_intp *countptr, NpyIter_IterNextFunc *iternext, int needs_api, npy_intp skip_first_count, void *data) |
Functions | |
NPY_NO_EXPORT PyArrayObject * | PyUFunc_ReduceWrapper (PyArrayObject *operand, PyArrayObject *out, PyArrayObject *wheremask, PyArray_Descr *operand_dtype, PyArray_Descr *result_dtype, NPY_CASTING casting, npy_bool *axis_flags, int reorderable, int keepdims, int subok, PyArray_AssignReduceIdentityFunc *assign_identity, PyArray_ReduceLoopFunc *loop, void *data, npy_intp buffersize, const char *funcname) |
typedef int( PyArray_AssignReduceIdentityFunc)(PyArrayObject *result, void *data) |
typedef int( PyArray_ReduceLoopFunc)(NpyIter *iter, char **dataptr, npy_intp *strideptr, npy_intp *countptr, NpyIter_IterNextFunc *iternext, int needs_api, npy_intp skip_first_count, void *data) |
<blockquote>
NPY_BEGIN_THREADS_DEF; if (!needs_api) {
<blockquote> NPY_BEGIN_THREADS;</blockquote>
} This first-visit loop can be skipped if 'assign_identity' was non-NULL if (skip_first_count > 0) {
<blockquote>
char *data0 = dataptr[0], *data1 = dataptr[1]; npy_intp stride0 = strideptr[0], stride1 = strideptr[1]; npy_intp count = *countptr;
// Skip any first-visit elements if (NpyIter_IsFirstVisit(iter, 0)) {
<blockquote>
} else {
<blockquote> skip_first_count -= count; count = 0;</blockquote>
} </blockquote>
}
data0 += stride0; data1 += stride1;
}
// Jump to the faster loop when skipping is done if (skip_first_count == 0) {
<blockquote>
} else {
<blockquote> goto finish_loop;</blockquote>
} </blockquote>
}
} while (iternext(iter)); </blockquote>
} do {
<blockquote>
char *data0 = dataptr[0], *data1 = dataptr[1]; npy_intp stride0 = strideptr[0], stride1 = strideptr[1]; npy_intp count = *countptr;
data0 += stride0; data1 += stride1;
} </blockquote>
} while (iternext(iter));
} return (needs_api && PyErr_Occurred()) ? -1 : 0;
NPY_NO_EXPORT PyArrayObject* PyUFunc_ReduceWrapper | ( | PyArrayObject * | operand, |
PyArrayObject * | out, | ||
PyArrayObject * | wheremask, | ||
PyArray_Descr * | operand_dtype, | ||
PyArray_Descr * | result_dtype, | ||
NPY_CASTING | casting, | ||
npy_bool * | axis_flags, | ||
int | reorderable, | ||
int | keepdims, | ||
int | subok, | ||
PyArray_AssignReduceIdentityFunc * | assign_identity, | ||
PyArray_ReduceLoopFunc * | loop, | ||
void * | data, | ||
npy_intp | buffersize, | ||
const char * | funcname | ||
) |
<blockquote> so that support can be added in the future without breaking API compatibility. Pass in NULL.</blockquote>
<blockquote> means specifying multiple axes of reduction at once is ok, and the reduction code may calculate the reduction in an arbitrary order. The calculation may be reordered because of cache behavior or multithreading requirements.</blockquote>
<blockquote> so that support can be added in the future without breaking API compatibility. Pass in NULL.</blockquote>
<blockquote> means specifying multiple axes of reduction at once is ok, and the reduction code may calculate the reduction in an arbitrary order. The calculation may be reordered because of cache behavior or multithreading requirements.</blockquote>