diff options
author | Travis Oliphant <oliphant@enthought.com> | 2005-10-03 17:13:50 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2005-10-03 17:13:50 +0000 |
commit | 68a551cd82261a8f0dcc180122f15b6150026866 (patch) | |
tree | b8e4a21fe5a24833b749ac673032b95c36030b43 /scipy/base/function_base.py | |
parent | c04829a2d3e4dcd75fc8409fc27f7493fe845262 (diff) | |
download | numpy-68a551cd82261a8f0dcc180122f15b6150026866.tar.gz |
Several fixes.
Diffstat (limited to 'scipy/base/function_base.py')
-rw-r--r-- | scipy/base/function_base.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scipy/base/function_base.py b/scipy/base/function_base.py index 1171da49a..674729496 100644 --- a/scipy/base/function_base.py +++ b/scipy/base/function_base.py @@ -151,7 +151,7 @@ def average (a, axis=0, weights=None, returned=0): d = len(a) * 1.0 else: w = array(weights).ravel() * 1.0 - n = add.reduce(a*w) + n = add.reduce(multiply(a,w)) d = add.reduce(w) else: a = array(a) @@ -685,22 +685,22 @@ def round_(x, decimals=0): same way as standard Python. """ x = asarray(x) - if not issubclass(x.dtype, inexact): + if not issubclass(x.dtype, _nx.inexact): return x - if issubclass(x.dtype, complexfloating): + if issubclass(x.dtype, _nx.complexfloating): return round_(x.real, decimals) + 1j*round_(x.imag, decimals) if decimals is not 0: decimals = asarray(decimals) - s = sign(m) + s = sign(x) if decimals is not 0: - m = absolute(m*10.**decimals) + x = absolute(multiply(x,10.**decimals)) else: - m = absolute(m) - rem = m-asarray(m).astype(intp) - m = where(less(rem,0.5), floor(m), ceil(m)) + x = absolute(x) + rem = x-asarray(x).astype(_nx.intp) + x = _nx.where(_nx.less(rem,0.5), _nx.floor(x), _nx.ceil(x)) # convert back if decimals is not 0: - return m*s/(10.**decimals) + return multiply(x,s/(10.**decimals)) else: - return m*s + return multiply(x,s) |