summaryrefslogtreecommitdiff
path: root/numpy/core/tests
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2023-03-27 09:55:35 +0300
committermattip <matti.picus@gmail.com>2023-03-27 09:55:35 +0300
commit47df67bb6c83d68c3254b69a44426b02d3f24caa (patch)
treed4f21798b4535b99afb7ce0bc6d8281c0ef6f7d8 /numpy/core/tests
parent7761175e3df8ef30b09e2d71113251cd2de8f6f9 (diff)
downloadnumpy-47df67bb6c83d68c3254b69a44426b02d3f24caa.tar.gz
BUG: in the fastest path form ufunc.at, properly increment args[2]
Diffstat (limited to 'numpy/core/tests')
-rw-r--r--numpy/core/tests/test_ufunc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index 498a654c8..04add9fa7 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -2054,6 +2054,17 @@ class TestUfunc:
# If it is [-1, -1, -1, -100, 0] then the regular strided loop was used
assert np.all(arr == [-1, -1, -1, -200, -1])
+ def test_ufunc_at_large(self):
+ # issue gh-23457
+ indices = np.zeros(8195, dtype=np.int16)
+ b = np.zeros(8195, dtype=float)
+ b[0] = 10
+ b[1] = 5
+ b[8192:] = 100
+ a = np.zeros(1, dtype=float)
+ np.add.at(a, indices, b)
+ assert a[0] == b.sum()
+
def test_cast_index_fastpath(self):
arr = np.zeros(10)
values = np.ones(100000)