diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-08-06 12:17:32 -0500 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-08-06 16:19:44 -0500 |
commit | 351fe979580ab842cc5c04e1b616d3a64936a695 (patch) | |
tree | 125667f5383a7fe33b50b59e586b9a4ca782278f /numpy/linalg/linalg.py | |
parent | 917700c8576231004fe541d5956da8ca9188ca7e (diff) | |
download | numpy-351fe979580ab842cc5c04e1b616d3a64936a695.tar.gz |
MAINT: Remove unneeded asfarray
As of gh-7088, x is always a float array anyway
Diffstat (limited to 'numpy/linalg/linalg.py')
-rw-r--r-- | numpy/linalg/linalg.py | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 0f1966a9b..cd8999785 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -2201,18 +2201,7 @@ def norm(x, ord=None, axis=None, keepdims=False): ord + 1 except TypeError: raise ValueError("Invalid norm order for vectors.") - if x.dtype.type is longdouble: - # Convert to a float type, so integer arrays give - # float results. Don't apply asfarray to longdouble arrays, - # because it will downcast to float64. - absx = abs(x) - else: - absx = x if isComplexType(x.dtype.type) else asfarray(x) - if absx.dtype is x.dtype: - absx = abs(absx) - else: - # if the type changed, we can safely overwrite absx - abs(absx, out=absx) + absx = abs(x) absx **= ord return add.reduce(absx, axis=axis, keepdims=keepdims) ** (1.0 / ord) elif len(axis) == 2: |