diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-01-24 09:13:40 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-01-24 09:22:42 -0700 |
commit | 7c1435c11d8bc0d1a3a380bc541a46f75749dc52 (patch) | |
tree | 5a02b21a6ff9bc8303981cb13d79f585a1085732 /numpy/polynomial | |
parent | ccbbfd5fd4c0377672aff5701e3624254b3a3138 (diff) | |
download | numpy-7c1435c11d8bc0d1a3a380bc541a46f75749dc52.tar.gz |
MAINT: Use a better method to detect complex arrays.
Instead of
if lhs.dtype.char in np.typecodes['Complex']:
use
if issubclass(lhs.dtype.type, np.complexfloating):
Diffstat (limited to 'numpy/polynomial')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 2 | ||||
-rw-r--r-- | numpy/polynomial/hermite.py | 2 | ||||
-rw-r--r-- | numpy/polynomial/hermite_e.py | 2 | ||||
-rw-r--r-- | numpy/polynomial/laguerre.py | 2 | ||||
-rw-r--r-- | numpy/polynomial/legendre.py | 2 | ||||
-rw-r--r-- | numpy/polynomial/polynomial.py | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 4d87c8470..afeafcb68 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -1743,7 +1743,7 @@ def chebfit(x, y, deg, rcond=None, full=False, w=None): rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. - if lhs.dtype.char in np.typecodes['Complex']: + if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 66940a28e..2beb848ae 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -1520,7 +1520,7 @@ def hermfit(x, y, deg, rcond=None, full=False, w=None): rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. - if lhs.dtype.char in np.typecodes['Complex']: + if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py index 9ff7c06d2..c183a5a86 100644 --- a/numpy/polynomial/hermite_e.py +++ b/numpy/polynomial/hermite_e.py @@ -1516,7 +1516,7 @@ def hermefit(x, y, deg, rcond=None, full=False, w=None): rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. - if lhs.dtype.char in np.typecodes['Complex']: + if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py index 6e035ebd2..f0c1268bf 100644 --- a/numpy/polynomial/laguerre.py +++ b/numpy/polynomial/laguerre.py @@ -1519,7 +1519,7 @@ def lagfit(x, y, deg, rcond=None, full=False, w=None): rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. - if lhs.dtype.char in np.typecodes['Complex']: + if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index e909ad9b1..0efd13ffa 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -1544,7 +1544,7 @@ def legfit(x, y, deg, rcond=None, full=False, w=None): rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. - if lhs.dtype.char in np.typecodes['Complex']: + if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py index 4e24e9c1f..8d7251b19 100644 --- a/numpy/polynomial/polynomial.py +++ b/numpy/polynomial/polynomial.py @@ -1366,7 +1366,7 @@ def polyfit(x, y, deg, rcond=None, full=False, w=None): rcond = len(x)*np.finfo(x.dtype).eps # Determine the norms of the design matrix columns. - if lhs.dtype.char in np.typecodes['Complex']: + if issubclass(lhs.dtype.type, np.complexfloating): scl = np.sqrt((np.square(lhs.real) + np.square(lhs.imag)).sum(1)) else: scl = np.sqrt(np.square(lhs).sum(1)) |