summaryrefslogtreecommitdiff
path: root/scipy/base/scimath.py
diff options
context:
space:
mode:
authorcookedm <cookedm@localhost>2005-10-29 22:24:51 +0000
committercookedm <cookedm@localhost>2005-10-29 22:24:51 +0000
commitc4fae16d0bd5d6cdeea17eff491d1f2fd33bb8eb (patch)
treeb70c518072f8502835e447504a6e607f17b3f706 /scipy/base/scimath.py
parente380b12e4779e4491619e8612a7e1b198ab03590 (diff)
downloadnumpy-c4fae16d0bd5d6cdeea17eff491d1f2fd33bb8eb.tar.gz
some clean up for scimath.py, use type objects instead of typechars
Diffstat (limited to 'scipy/base/scimath.py')
-rw-r--r--scipy/base/scimath.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/scipy/base/scimath.py b/scipy/base/scimath.py
index aa5ada849..b651322f8 100644
--- a/scipy/base/scimath.py
+++ b/scipy/base/scimath.py
@@ -1,28 +1,27 @@
-## Automatically adapted for scipy Sep 19, 2005 by convertcode.py
-
"""
Wrapper functions to more user-friendly calling of certain math functions
whose output is different than the input in certain domains of the input.
"""
-__all__ = ['sqrt', 'log', 'log2','logn','log10', 'power', 'arccos',
+__all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos',
'arcsin', 'arctanh']
-import numeric as _nx
+import numeric as nx
from numeric import *
from type_check import isreal, asscalar
-__all__.extend([key for key in dir(_nx.umath) \
- if key[0]!='_' and key not in __all__])
+__all__.extend([key for key in dir(nx.umath)
+ if key[0] != '_' and key not in __all__])
_ln2 = log(2.0)
def _tocomplex(arr):
- if arr.dtypechar in ['f', 'h', 'B', 'b','H']:
- return arr.astype('F')
+ if isinstance(arr.dtype, (nx.single, nx.byte, nx.short, nx.ubyte,
+ nx.ushort)):
+ return arr.astype(nx.csingle)
else:
- return arr.astype('D')
+ return arr.astype(nx.cdouble)
def _fix_real_lt_zero(x):
x = asarray(x)
@@ -38,17 +37,17 @@ def _fix_real_abs_gt_1(x):
def sqrt(x):
x = _fix_real_lt_zero(x)
- return _nx.sqrt(x)
+ return nx.sqrt(x)
def log(x):
x = _fix_real_lt_zero(x)
- return _nx.log(x)
+ return nx.log(x)
def log10(x):
x = _fix_real_lt_zero(x)
- return _nx.log10(x)
+ return nx.log10(x)
-def logn(n,x):
+def logn(n, x):
""" Take log base n of x.
"""
x = _fix_real_lt_zero(x)
@@ -63,7 +62,7 @@ def log2(x):
def power(x, p):
x = _fix_real_lt_zero(x)
- return _nx.power(x, p)
+ return nx.power(x, p)
def arccos(x):
x = _fix_real_abs_gt_1(x)