summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/arraytypes.c.src4
-rw-r--r--numpy/core/tests/test_multiarray.py10
2 files changed, 12 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src
index d2532ccf0..c4130353b 100644
--- a/numpy/core/src/multiarray/arraytypes.c.src
+++ b/numpy/core/src/multiarray/arraytypes.c.src
@@ -2991,7 +2991,7 @@ static int
memcpy(mp, ip, elsize);
*max_ind = 0;
for (i = 1; i < n; i++) {
- ip += elsize;
+ ip += elsize / sizeof(@type@);
if (@fname@_compare(ip, mp, aip) > 0) {
memcpy(mp, ip, elsize);
*max_ind = i;
@@ -3048,7 +3048,7 @@ static int
memcpy(mp, ip, elsize);
*min_ind = 0;
for(i=1; i<n; i++) {
- ip += elsize;
+ ip += elsize / sizeof(@type@);
if (@fname@_compare(mp,ip,aip) > 0) {
memcpy(mp, ip, elsize);
*min_ind=i;
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index d02821cba..e49f905f9 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -2144,6 +2144,11 @@ class TestArgmax(TestCase):
a.argmax(-1, out=out)
assert_equal(out, a.argmax(-1))
+ def test_argmax_unicode(self):
+ d = np.zeros(6031, dtype='<U9')
+ d[5942] = "as"
+ assert_equal(d.argmax(), 5942)
+
class TestArgmin(TestCase):
@@ -2249,6 +2254,11 @@ class TestArgmin(TestCase):
a.argmin(-1, out=out)
assert_equal(out, a.argmin(-1))
+ def test_argmin_unicode(self):
+ d = np.ones(6031, dtype='<U9')
+ d[6001] = "0"
+ assert_equal(d.argmin(), 6001)
+
class TestMinMax(TestCase):
def test_scalar(self):