[Numpy-svn] r4813 - in trunk/numpy: core lib

numpy-svn@scip... numpy-svn@scip...
Tue Feb 19 17:50:00 CST 2008


Author: matthew.brett@gmail.com
Date: 2008-02-19 17:49:50 -0600 (Tue, 19 Feb 2008)
New Revision: 4813

Modified:
   trunk/numpy/core/fromnumeric.py
   trunk/numpy/lib/function_base.py
Log:
cumprod docstring, median input array coercion

Modified: trunk/numpy/core/fromnumeric.py
===================================================================
--- trunk/numpy/core/fromnumeric.py	2008-02-19 19:43:56 UTC (rev 4812)
+++ trunk/numpy/core/fromnumeric.py	2008-02-19 23:49:50 UTC (rev 4813)
@@ -1061,6 +1061,33 @@
 def cumprod(a, axis=None, dtype=None, out=None):
     """Return the cumulative product of the elements along the given axis.
 
+    The cumulative product is taken over the flattened array by
+    default, otherwise over the specified axis.
+
+    Parameters
+    ----------
+    a : array-like
+        Input array or object that can be converted to an array
+    axis : {None, -1, int}, optional
+        Axis along which the product is computed. The default
+        (``axis``= None) is to compute over the flattened array.
+    dtype : type, optional
+        Type to use in computing the cumulative product. For arrays of
+        integer type the default is int64 for signed ints and uint64
+        for unsigned. For arrays of float types it is the same as the
+        array type. 
+    out : ndarray, optional
+        Alternative output array in which to place the result. It must
+        have the same shape and buffer length as the expected output
+        but the type will be cast if necessary.
+
+    Returns
+    -------
+    cumprod : ndarray.
+        A new array holding the result is returned unless out is
+        specified, in which case a reference to out is returned.
+        Return datatype is ``dtype`` if specified, otherwise int64 for
+        ints, uint64 for uints, or the input datatype otherwise.
     """
     try:
         cumprod = a.cumprod

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2008-02-19 19:43:56 UTC (rev 4812)
+++ trunk/numpy/lib/function_base.py	2008-02-19 23:49:50 UTC (rev 4813)
@@ -1208,6 +1208,8 @@
 
     Parameters
     ----------
+    a : array-like
+        Input array or object that can be converted to an array
     axis : {int, None}, optional
         Axis along which the medians are computed. The default is to
         compute the median along the first dimension.  axis=None
@@ -1234,7 +1236,7 @@
         Return datatype is float64 for ints and floats smaller than
         float64, or the input datatype otherwise.
 
-    SeeAlso
+    See Also
     -------
     mean
 
@@ -1273,6 +1275,7 @@
     3.5
     >>> assert not np.all(a==b)
     """
+    a = asanyarray(a)
     if overwrite_input:
         if axis is None:
             sorted = a.ravel()



More information about the Numpy-svn mailing list