summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2023-02-07 10:51:58 +0200
committermattip <matti.picus@gmail.com>2023-02-07 10:51:58 +0200
commit163d3c533d37fa76727ecdee429446ad41aac7f2 (patch)
treed709052bf8694f2c5c38f28e008023119f6e12d3 /numpy/core/src
parentff97723de0ff365f5d7f2b30be5ac7987511a584 (diff)
downloadnumpy-163d3c533d37fa76727ecdee429446ad41aac7f2.tar.gz
BUG: improve check for 1d operands (from review)
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/umath/ufunc_object.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 63994c258..60efdce96 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -6436,12 +6436,15 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
/*
* Try to use trivial loop (1d, no casting, aligned) if
* - the matching info has a indexed loop
+ * - idx must be exactly one integer index array
* - all operands are 1d
+ * A future enhancement could loosen the restriction on 1d operands
+ * by adding an iteration loop inside trivial_at_loop
*/
if ((ufuncimpl->contiguous_indexed_loop != NULL) &&
(PyArray_NDIM(op1_array) == 1) &&
(op2_array != NULL && PyArray_NDIM(op2_array) == 1) &&
- (iter->nd == 1)) {
+ (iter->subspace_iter == NULL) && (iter->numiter == 1)) {
res = trivial_at_loop(ufuncimpl, flags, iter, op1_array,
op2_array, &context);