| 5991 | } |
| 5992 | |
| 5993 | static int |
| 5994 | ufunc_at__fast_iter(PyUFuncObject *ufunc, NPY_ARRAYMETHOD_FLAGS flags, |
| 5995 | PyArrayMapIterObject *iter, PyArrayIterObject *iter2, |
| 5996 | PyArrayObject *op1_array, PyArrayObject *op2_array, |
| 5997 | PyArrayMethod_StridedLoop *strided_loop, |
| 5998 | PyArrayMethod_Context *context, |
| 5999 | NpyAuxData *auxdata |
| 6000 | ) |
| 6001 | { |
| 6002 | int buffersize; |
| 6003 | int errormask = 0; |
| 6004 | int res = 0; |
| 6005 | NPY_BEGIN_THREADS_DEF; |
| 6006 | |
| 6007 | if (_get_bufsize_errmask(NULL, ufunc->name, &buffersize, &errormask) < 0) { |
| 6008 | return -1; |
| 6009 | } |
| 6010 | int needs_api = (flags & NPY_METH_REQUIRES_PYAPI) != 0; |
| 6011 | if (!(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) { |
| 6012 | /* Start with the floating-point exception flags cleared */ |
| 6013 | npy_clear_floatstatus_barrier((char*)&iter); |
| 6014 | } |
| 6015 | |
| 6016 | if (!needs_api) { |
| 6017 | NPY_BEGIN_THREADS; |
| 6018 | } |
| 6019 | |
| 6020 | npy_intp strides[3] = {0, 0, 0}; |
| 6021 | /* |
| 6022 | * Iterate over first and second operands and call ufunc |
| 6023 | * for each pair of inputs |
| 6024 | */ |
| 6025 | for (npy_intp i = iter->size; i > 0; i--) |
| 6026 | { |
| 6027 | char *dataptr[3]; |
| 6028 | /* one element at a time, no stride required but read by innerloop */ |
| 6029 | npy_intp count = 1; |
| 6030 | |
| 6031 | /* |
| 6032 | * Set up data pointers for either one or two input operands. |
| 6033 | * The output data pointer points to the first operand data. |
| 6034 | */ |
| 6035 | dataptr[0] = iter->dataptr; |
| 6036 | if (iter2 != NULL) { |
| 6037 | dataptr[1] = PyArray_ITER_DATA(iter2); |
| 6038 | dataptr[2] = iter->dataptr; |
| 6039 | } |
| 6040 | else { |
| 6041 | dataptr[1] = iter->dataptr; |
| 6042 | dataptr[2] = NULL; |
| 6043 | } |
| 6044 | |
| 6045 | res = strided_loop(context, dataptr, &count, strides, auxdata); |
| 6046 | if (res != 0) { |
| 6047 | break; |
| 6048 | } |
| 6049 | |
| 6050 | PyArray_MapIterNext(iter); |
no test coverage detected