diff options
Diffstat (limited to 'numpy/lib/scimath.py')
-rw-r--r-- | numpy/lib/scimath.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/numpy/lib/scimath.py b/numpy/lib/scimath.py index 3da86d9c8..e07caf805 100644 --- a/numpy/lib/scimath.py +++ b/numpy/lib/scimath.py @@ -17,16 +17,21 @@ correctly handled. See their respective docstrings for specific examples. """ from __future__ import division, absolute_import, print_function -__all__ = ['sqrt', 'log', 'log2', 'logn', 'log10', 'power', 'arccos', - 'arcsin', 'arctanh'] - import numpy.core.numeric as nx import numpy.core.numerictypes as nt from numpy.core.numeric import asarray, any from numpy.lib.type_check import isreal + +__all__ = [ + 'sqrt', 'log', 'log2', 'logn', 'log10', 'power', 'arccos', 'arcsin', + 'arctanh' + ] + + _ln2 = nx.log(2.0) + def _tocomplex(arr): """Convert its input `arr` to a complex array. @@ -109,9 +114,10 @@ def _fix_real_lt_zero(x): >>> np.lib.scimath._fix_real_lt_zero([-1,2]) array([-1.+0.j, 2.+0.j]) + """ x = asarray(x) - if any(isreal(x) & (x<0)): + if any(isreal(x) & (x < 0)): x = _tocomplex(x) return x @@ -163,7 +169,7 @@ def _fix_real_abs_gt_1(x): array([ 0.+0.j, 2.+0.j]) """ x = asarray(x) - if any(isreal(x) & (abs(x)>1)): + if any(isreal(x) & (abs(x) > 1)): x = _tocomplex(x) return x |