[Numpy-svn] r3420 - in trunk/numpy/core: src tests

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Oct 30 23:17:51 CST 2006


Author: oliphant
Date: 2006-10-30 23:17:46 -0600 (Mon, 30 Oct 2006)
New Revision: 3420

Modified:
   trunk/numpy/core/src/arraytypes.inc.src
   trunk/numpy/core/tests/test_regression.py
Log:
Fix OBJECT_argmax problem and add test.

Modified: trunk/numpy/core/src/arraytypes.inc.src
===================================================================
--- trunk/numpy/core/src/arraytypes.inc.src	2006-10-30 22:45:31 UTC (rev 3419)
+++ trunk/numpy/core/src/arraytypes.inc.src	2006-10-31 05:17:46 UTC (rev 3420)
@@ -1775,8 +1775,7 @@
                 mp=ip[i];
                 i++;
         }
-        if (i==n) return 0;
-        for(i=n; i<n; i++) {
+        for(; i<n; i++) {
                 ip++;
                 if (*ip != NULL && PyObject_Compare(*ip,mp) > 0) {
                         mp = *ip;

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2006-10-30 22:45:31 UTC (rev 3419)
+++ trunk/numpy/core/tests/test_regression.py	2006-10-31 05:17:46 UTC (rev 3420)
@@ -551,6 +551,10 @@
         a = N.array([1,2,3])
         a2 = N.array([[1,2,3]])
         assert_equal(a[N.where(a==3)], a2[N.where(a2==3)])
+
+    def check_object_argmax(self, level=rlevel):
+        a = N.array([1,2,3],dtype=object)
+        assert a.argmax() == 2
                 
 if __name__ == "__main__":
     NumpyTest().run()



More information about the Numpy-svn mailing list