[Numpy-svn] r4803 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Wed Feb 13 19:32:25 CST 2008


Author: matthew.brett@gmail.com
Date: 2008-02-13 19:32:20 -0600 (Wed, 13 Feb 2008)
New Revision: 4803

Modified:
   trunk/numpy/lib/function_base.py
Log:
Fixed median axis=None raveling in case of copy

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2008-02-13 23:10:44 UTC (rev 4802)
+++ trunk/numpy/lib/function_base.py	2008-02-14 01:32:20 UTC (rev 4803)
@@ -1262,18 +1262,22 @@
     array([ 6.5,  4.5,  2.5])
     >>> m
     array([ 6.5,  4.5,  2.5])
-    >>> median(a, axis=1, overwrite_input=True)
+    >>> b = a.copy()
+    >>> median(b, axis=1, overwrite_input=True)
     array([ 7.,  2.])
-    >>> a # modified, undefined, sorted in this case
-    array([[ 4,  7, 10],
-           [ 1,  2,  3]])
+    >>> assert not np.all(a==b)
+    >>> b = a.copy()
+    >>> median(b, axis=None, overwrite_input=True)
+    3.5
+    >>> assert not np.all(a==b)
     """
     if overwrite_input:
         if axis is None:
-            a.ravel.sort()
+            sorted = a.ravel()
+            sorted.sort()
         else:
             a.sort(axis=axis)
-        sorted = a
+            sorted = a
     else:
         sorted = sort(a, axis=axis)
     if axis is None:



More information about the Numpy-svn mailing list