[Numpy-svn] r3130 - in trunk/numpy: . core
numpy-svn at scipy.org
numpy-svn at scipy.org
Thu Sep 7 12:13:44 CDT 2006
Author: charris
Date: 2006-09-07 12:13:42 -0500 (Thu, 07 Sep 2006)
New Revision: 3130
Modified:
trunk/numpy/add_newdocs.py
trunk/numpy/core/fromnumeric.py
Log:
Documentation tweaks for searchsorted and round.
Modified: trunk/numpy/add_newdocs.py
===================================================================
--- trunk/numpy/add_newdocs.py 2006-09-07 07:04:13 UTC (rev 3129)
+++ trunk/numpy/add_newdocs.py 2006-09-07 17:13:42 UTC (rev 3130)
@@ -937,17 +937,18 @@
Reference to out, where None specifies the original array a.
Round to the specified number of decimals. When 'decimals' is negative it
- specifies the number of positions to the left of the decimal point. The real
- and imaginary parts of complex numbers are rounded separately. Nothing is
- done if the array is not of float type and 'decimals' is >= 0.
+ specifies the number of positions to the left of the decimal point. The
+ real and imaginary parts of complex numbers are rounded separately. Nothing
+ is done if the array is not of float type and 'decimals' is >= 0.
The keyword 'out' may be used to specify a different array to hold the
result rather than the default 'a'. If the type of the array specified by
- 'out' differs from that of 'a', the result is cast to the new type.
+ 'out' differs from that of 'a', the result is cast to the new type,
+ otherwise the original type is kept. Floats round to floats by default.
- Numpy rounds to even. Thus 1.5 and 2.5 round to 2, -0.5 and 0.5 round to 0,
- etc. Results may also be surprising due to the inexact representation of
- decimal fractions in IEEE floating point and the errors introduced in
+ Numpy rounds to even. Thus 1.5 and 2.5 round to 2.0, -0.5 and 0.5 round to
+ 0.0, etc. Results may also be surprising due to the inexact representation
+ of decimal fractions in IEEE floating point and the errors introduced in
scaling the numbers when 'decimals' is something other than 0.
"""))
@@ -960,7 +961,7 @@
v -- array of keys to be searched for in a.
Keyword arguments:
- side -- {'left', 'right'}, default('left').
+ side -- {'left', 'right'}, (default 'left').
Returns:
index array with the same shape as keys.
@@ -978,9 +979,9 @@
a[j] < key <= a[i] for all j < i,
If such an index does not exist, a.size() is used. Consequently, i is the
- index of the first item in a that is >= key. If the key were to be inserted
- into a in the slot before the index i, then the order of a would be
- preserved and i would be the smallest index with that property.
+ index of the first item in 'a' that is >= key. If the key were to be
+ inserted into a in the slot before the index i, then the order of a would
+ be preserved and i would be the smallest index with that property.
The method call
@@ -992,9 +993,9 @@
a[j] <= key < a[i] for all j < i,
If such an index does not exist, a.size() is used. Consequently, i is the
- index of the first item in a that is > key. If the key were to be inserted
- into a in the slot before the index i, then the order of a would be
- preserved and i would be the largest index with that property.
+ index of the first item in 'a' that is > key. If the key were to be
+ inserted into a in the slot before the index i, then the order of a would
+ be preserved and i would be the largest index with that property.
"""))
Modified: trunk/numpy/core/fromnumeric.py
===================================================================
--- trunk/numpy/core/fromnumeric.py 2006-09-07 07:04:13 UTC (rev 3129)
+++ trunk/numpy/core/fromnumeric.py 2006-09-07 17:13:42 UTC (rev 3130)
@@ -245,10 +245,10 @@
a[j] < key <= a[i] for all j < i,
- If such an index does not exist, a.size() is used. The result is such that
- if the key were to be inserted into a in the slot before the index i, then
- the order of a would be preserved and i would be the smallest index with
- that property.
+ If such an index does not exist, a.size() is used. Consequently, i is the
+ index of the first item in 'a' that is >= key. If the key were to be
+ inserted into a in the slot before the index i, then the order of a would
+ be preserved and i would be the smallest index with that property.
The function call
@@ -259,10 +259,10 @@
a[j] <= key < a[i] for all j < i,
- If such an index does not exist, a.size() is used. The result is such that
- if the key were to be inserted into a in the slot before the index i, then
- the order of a would be preserved and i would be the largest index with
- that property.
+ If such an index does not exist, a.size() is used. Consequently, i is the
+ index of the first item in 'a' that is > key. If the key were to be
+ inserted into a in the slot before the index i, then the order of a would
+ be preserved and i would be the largest index with that property.
"""
try:
@@ -549,10 +549,10 @@
"""Returns reference to result. Copies a and rounds to 'decimals' places.
Keyword arguments:
- decimals -- number of decimals to round to (default 0). May be negative.
+ decimals -- number of decimal places to round to (default 0).
out -- existing array to use for output (default copy of a).
- Return:
+ Returns:
Reference to out, where None specifies a copy of the original array a.
Round to the specified number of decimals. When 'decimals' is negative it
@@ -562,15 +562,17 @@
than or equal to 0.
The keyword 'out' may be used to specify a different array to hold the
- result rather than the default copy of 'a'. If the type of the array
- specified by 'out' differs from that of 'a', the result is cast to the new
- type.
+ result rather than the default 'a'. If the type of the array specified by
+ 'out' differs from that of 'a', the result is cast to the new type,
+ otherwise the original type is kept. Floats round to floats by default.
- Numpy rounds to even. Thus 1.5 and 2.5 round to 2, -0.5 and 0.5 round to 0,
- etc. Results may also be surprising due to the inexact representation of
- decimal fractions in IEEE floating point and the errors introduced in
+ Numpy rounds to even. Thus 1.5 and 2.5 round to 2.0, -0.5 and 0.5 round to
+ 0.0, etc. Results may also be surprising due to the inexact representation
+ of decimal fractions in IEEE floating point and the errors introduced in
scaling the numbers when 'decimals' is something other than 0.
+ The function around is an alias for round_.
+
"""
try:
round = a.round
More information about the Numpy-svn
mailing list