8000 ENH: create and use indexed inner loops by mattip · Pull Request #23136 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: create and use indexed inner loops #23136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Feb 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: fixes from review
  • Loading branch information
mattip committed Feb 7, 2023
commit b80bc2d324ddbbb1fae7e690c641b62c3923ddcf
16 changes: 4 additions & 12 deletions numpy/core/src/umath/ufunc_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -5920,21 +5920,17 @@ trivial_at_loop(PyArrayMethodObject *ufuncimpl, NPY_ARRAYMETHOD_FLAGS flags,

npy_intp *inner_size = NpyIter_GetInnerLoopSizePtr(iter->outer);

if (!(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
npy_clear_floatstatus_barrier((char *)context);
}

do {
args[1] = (char *) iter->outer_ptrs[0];
steps[1] = iter->outer_strides[0];

res = ufuncimpl->contiguous_indexed_loop(
context, args, inner_size, steps, NULL);
} while (res == 0 && iter->outer_next(iter->outer));
/*
* An error should only be possible if `res != 0` is already set.
* But this is not strictly correct since old-style ufuncs (e.g. `power`
* released the GIL but manually set an Exception).
*/
if (PyErr_Occurred()) {
res = -1;
}

if (res == 0 && !(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
const char * ufunc_name =
Expand Down Expand Up @@ -6355,10 +6351,6 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
}
}

/*
* Create a map iterator (there is no multi-mapiter, so we need at least 2
* iterators: one for the mapping, and another for the second operand)
*/
iter = (PyArrayMapIterObject *)PyArray_MapIterArrayCopyIfOverlap(
op1_array, idx, 1, op2_array);
if (iter == NULL) {
Expand Down
0