# [Numpy-svn] r3189 - in trunk/numpy: . core

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Sep 19 11:56:28 CDT 2006

Author: charris
Date: 2006-09-19 11:56:07 -0500 (Tue, 19 Sep 2006)
New Revision: 3189

Modified:
trunk/numpy/core/fromnumeric.py
Log:
Fix ticket #284

===================================================================
--- trunk/numpy/add_newdocs.py	2006-09-19 13:19:07 UTC (rev 3188)
+++ trunk/numpy/add_newdocs.py	2006-09-19 16:56:07 UTC (rev 3189)
@@ -356,7 +356,7 @@

-    """lexsort(keys=, axis=-1)
+    """lexsort(keys=, axis=-1) -> array of indices. argsort with list of keys.

Return an array of indices similar to argsort, except the sorting is
done using the provided sorting keys.  First the sort is done using
@@ -658,7 +658,7 @@

This method executes an indirect sort along the given axis using the
algorithm specified by the kind keyword. It returns an array of indices of
-    the same shape as a that index data along the given axis in sorted order.
+    the same shape as 'a' that index data along the given axis in sorted order.

The various sorts are characterized by average speed, worst case
performance, need for work space, and whether they are stable. A stable
@@ -668,9 +668,9 @@
|------------------------------------------------------|
|    kind   | speed |  worst case | work space | stable|
|------------------------------------------------------|
-    |'quicksort'|   1   |   o(n^2)    |      0     |   no  |
-    |'mergesort'|   2   | o(n*log(n)) |    ~n/2    |   yes |
-    |'heapsort' |   3   | o(n*log(n)) |      0     |   no  |
+    |'quicksort'|   1   | O(n^2)      |     0      |   no  |
+    |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
+    |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
|------------------------------------------------------|

All the sort algorithms make temporary copies of the data when the sort is
@@ -1024,7 +1024,7 @@

Returns: None.

-    This method sorts a in place along the given axis using the algorithm
+    This method sorts 'a' in place along the given axis using the algorithm
specified by the kind keyword.

The various sorts may characterized by average speed, worst case
@@ -1036,9 +1036,9 @@
|------------------------------------------------------|
|    kind   | speed |  worst case | work space | stable|
|------------------------------------------------------|
-    |'quicksort'|   1   |    o(n)     |      0     |   no  |
-    |'mergesort'|   2   | o(n*log(n)) |    ~n/2    |   yes |
-    |'heapsort' |   3   | o(n*log(n)) |      0     |   no  |
+    |'quicksort'|   1   | O(n^2)      |     0      |   no  |
+    |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
+    |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
|------------------------------------------------------|

All the sort algorithms make temporary copies of the data when the sort is

Modified: trunk/numpy/core/fromnumeric.py
===================================================================
--- trunk/numpy/core/fromnumeric.py	2006-09-19 13:19:07 UTC (rev 3188)
+++ trunk/numpy/core/fromnumeric.py	2006-09-19 16:56:07 UTC (rev 3189)
@@ -125,7 +125,7 @@
return transpose(axes)

def sort(a, axis=-1, kind='quicksort'):
-    """Return copy of array sorted along the given axis.
+    """Returns copy of 'a' sorted along the given axis.

Keyword arguments:

@@ -135,7 +135,7 @@

Returns: None.

-    This method sorts a in place along the given axis using the algorithm
+    This method sorts 'a' in place along the given axis using the algorithm
specified by the kind keyword.

The various sorts may characterized by average speed, worst case
@@ -147,9 +147,9 @@
|------------------------------------------------------|
|    kind   | speed |  worst case | work space | stable|
|------------------------------------------------------|
-    |'quicksort'|   1   |    o(n)     |      0     |   no  |
-    |'mergesort'|   2   | o(n*log(n)) |    ~n/2    |   yes |
-    |'heapsort' |   3   | o(n*log(n)) |      0     |   no  |
+    |'quicksort'|   1   | O(n^2)      |     0      |   no  |
+    |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
+    |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
|------------------------------------------------------|

All the sort algorithms make temporary copies of the data when the sort is
@@ -162,7 +162,7 @@
return a

def argsort(a, axis=-1, kind='quicksort'):
-    """Return array of indices that index a in sorted order.
+    """Returns array of indices that index 'a' in sorted order.

Keyword arguments:

@@ -170,11 +170,11 @@
kind -- sorting algorithm (default 'quicksort')
Possible values: 'quicksort', 'mergesort', or 'heapsort'

-    Returns: array of indices that sort a along the specified axis.
+    Returns: array of indices that sort 'a' along the specified axis.

This method executes an indirect sort along the given axis using the
algorithm specified by the kind keyword. It returns an array of indices of
-    the same shape as a that index data along the given axis in sorted order.
+    the same shape as 'a' that index data along the given axis in sorted order.

The various sorts are characterized by average speed, worst case
performance, need for work space, and whether they are stable. A stable
@@ -184,9 +184,9 @@
|------------------------------------------------------|
|    kind   | speed |  worst case | work space | stable|
|------------------------------------------------------|
-    |'quicksort'|   1   |   o(n^2)    |      0     |   no  |
-    |'mergesort'|   2   | o(n*log(n)) |    ~n/2    |   yes |
-    |'heapsort' |   3   | o(n*log(n)) |      0     |   no  |
+    |'quicksort'|   1   | O(n^2)      |     0      |   no  |
+    |'mergesort'|   2   | O(n*log(n)) |    ~n/2    |   yes |
+    |'heapsort' |   3   | O(n*log(n)) |     0      |   no  |
|------------------------------------------------------|

All the sort algorithms make temporary copies of the data when the sort is not