[Scipy-svn] r7037 - in trunk/scipy: fftpack/tests linalg

scipy-svn at scipy.org scipy-svn at scipy.org
Sat Jan 15 07:44:18 EST 2011


Author: rgommers
Date: 2011-01-15 06:44:17 -0600 (Sat, 15 Jan 2011)
New Revision: 7037

Modified:
   trunk/scipy/fftpack/tests/test_basic.py
   trunk/scipy/linalg/matfuncs.py
Log:
TST: fix ComplexWarnings by replacing .astype(float) by .real.astype(float).

Modified: trunk/scipy/fftpack/tests/test_basic.py
===================================================================
--- trunk/scipy/fftpack/tests/test_basic.py	2011-01-15 12:43:36 UTC (rev 7036)
+++ trunk/scipy/fftpack/tests/test_basic.py	2011-01-15 12:44:17 UTC (rev 7037)
@@ -417,8 +417,8 @@
         for size in SMALL_COMPOSITE_SIZES + SMALL_PRIME_SIZES:
             np.random.seed(1234)
             x = np.random.rand(size, size) + 1j*np.random.rand(size, size)
-            y1 = fftn(x.astype(np.float32))
-            y2 = fftn(x.astype(np.float64)).astype(np.complex64)
+            y1 = fftn(x.real.astype(np.float32))
+            y2 = fftn(x.real.astype(np.float64)).astype(np.complex64)
 
             self.failUnless(y1.dtype == np.complex64)
             assert_array_almost_equal_nulp(y1, y2, 2000)
@@ -426,8 +426,8 @@
         for size in LARGE_COMPOSITE_SIZES + LARGE_PRIME_SIZES:
             np.random.seed(1234)
             x = np.random.rand(size, 3) + 1j*np.random.rand(size, 3)
-            y1 = fftn(x.astype(np.float32))
-            y2 = fftn(x.astype(np.float64)).astype(np.complex64)
+            y1 = fftn(x.real.astype(np.float32))
+            y2 = fftn(x.real.astype(np.float64)).astype(np.complex64)
 
             self.failUnless(y1.dtype == np.complex64)
             assert_array_almost_equal_nulp(y1, y2, 2000)

Modified: trunk/scipy/linalg/matfuncs.py
===================================================================
--- trunk/scipy/linalg/matfuncs.py	2011-01-15 12:43:36 UTC (rev 7036)
+++ trunk/scipy/linalg/matfuncs.py	2011-01-15 12:44:17 UTC (rev 7037)
@@ -91,7 +91,7 @@
         t = 'd'
     s,vr = eig(A)
     vri = inv(vr)
-    return dot(dot(vr,diag(exp(s))),vri).astype(t)
+    return dot(dot(vr,diag(exp(s))),vri).real.astype(t)
 
 def expm3(A, q=20):
     """Compute the matrix exponential using Taylor series.




More information about the Scipy-svn mailing list