summaryrefslogtreecommitdiff
path: root/numpy/lib/ufunclike.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2008-08-05 09:20:07 +0000
committerStefan van der Walt <stefan@sun.ac.za>2008-08-05 09:20:07 +0000
commit6647bf7eaeb915e2d09db8b5c7584ee286962d3b (patch)
tree803c7d548fb8dc8f571aad76c6473f20ba71c01d /numpy/lib/ufunclike.py
parentf8f44a0595da3ae8be9458ead1366bcc72cd3390 (diff)
downloadnumpy-6647bf7eaeb915e2d09db8b5c7584ee286962d3b.tar.gz
Merge from documentation editor.
Diffstat (limited to 'numpy/lib/ufunclike.py')
-rw-r--r--numpy/lib/ufunclike.py77
1 files changed, 71 insertions, 6 deletions
diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py
index a8c2c1e25..37c38e94e 100644
--- a/numpy/lib/ufunclike.py
+++ b/numpy/lib/ufunclike.py
@@ -24,9 +24,30 @@ def fix(x, y=None):
return y
def isposinf(x, y=None):
- """Return a boolean array y with y[i] True for x[i] = +Inf.
+ """
+ Return True where x is +infinity, and False otherwise.
+
+ Parameters
+ ----------
+ x : array_like
+ The input array.
+ y : array_like
+ A boolean array with the same shape as `x` to store the result.
+
+ Returns
+ -------
+ y : ndarray
+ A boolean array where y[i] = True only if x[i] = +Inf.
+
+ See Also
+ --------
+ isneginf, isfinite
+
+ Examples
+ --------
+ >>> np.isposinf([-np.inf, 0., np.inf])
+ array([ False, False, True], dtype=bool)
- If y is an array, the result replaces the contents of y.
"""
if y is None:
x = asarray(x)
@@ -35,9 +56,30 @@ def isposinf(x, y=None):
return y
def isneginf(x, y=None):
- """Return a boolean array y with y[i] True for x[i] = -Inf.
+ """
+ Return True where x is -infinity, and False otherwise.
+
+ Parameters
+ ----------
+ x : array_like
+ The input array.
+ y : array_like
+ A boolean array with the same shape as `x` to store the result.
+
+ Returns
+ -------
+ y : ndarray
+ A boolean array where y[i] = True only if x[i] = -Inf.
+
+ See Also
+ --------
+ isposinf, isfinite
+
+ Examples
+ --------
+ >>> np.isneginf([-np.inf, 0., np.inf])
+ array([ True, False, False], dtype=bool)
- If y is an array, the result replaces the contents of y.
"""
if y is None:
x = asarray(x)
@@ -47,9 +89,32 @@ def isneginf(x, y=None):
_log2 = umath.log(2)
def log2(x, y=None):
- """Returns the base 2 logarithm of x
+ """
+ Return the base 2 logarithm.
+
+ Parameters
+ ----------
+ x : array_like
+ Input array.
+ y : array_like
+ Optional output array with the same shape as `x`.
+
+ Returns
+ -------
+ y : {ndarray, scalar}
+ The logarithm to the base 2 of `x` elementwise.
+ NaNs are returned where `x` is negative.
+
+
+ See Also
+ --------
+ log, log1p, log10
+
+ Examples
+ --------
+ >>> np.log2([-1,2,4])
+ array([ NaN, 1., 2.])
- If y is an array, the result replaces the contents of y.
"""
x = asanyarray(x)
if y is None: