diff options
author | Wansoo Kim <rladhkstn8@gmail.com> | 2020-07-14 16:43:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 10:43:34 +0300 |
commit | 197093bd7a455ce285b2415e45039cab83544269 (patch) | |
tree | c363bf5160af0834b98e0d373e38e82976caed5a | |
parent | c02d02024c0ea2195b87dba690c6c6b36bfd74a4 (diff) | |
download | numpy-197093bd7a455ce285b2415e45039cab83544269.tar.gz |
MAINT: Remove Duplicated Code (#16848)
* MAINT: Remove Duplicated Code
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
-rw-r--r-- | numpy/linalg/linalg.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 513ea8219..92f93d671 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -176,10 +176,9 @@ def _to_native_byte_order(*arrays): def _fastCopyAndTranspose(type, *arrays): cast_arrays = () for a in arrays: - if a.dtype.type is type: - cast_arrays = cast_arrays + (_fastCT(a),) - else: - cast_arrays = cast_arrays + (_fastCT(a.astype(type)),) + if a.dtype.type is not type: + a = a.astype(type) + cast_arrays = cast_arrays + (_fastCT(a),) if len(cast_arrays) == 1: return cast_arrays[0] else: |