[Numpy-svn] r6010 - trunk/numpy/core/tests

numpy-svn@scip... numpy-svn@scip...
Tue Nov 11 15:57:03 CST 2008


Author: charris
Date: 2008-11-11 15:57:01 -0600 (Tue, 11 Nov 2008)
New Revision: 6010

Modified:
   trunk/numpy/core/tests/test_umath.py
Log:
Debug commit seemed to work.
Add back all logaddexp, logaddexp2 tests.
Remove special log1p tests.
The existing log1p tests need some additions... 



Modified: trunk/numpy/core/tests/test_umath.py
===================================================================
--- trunk/numpy/core/tests/test_umath.py	2008-11-11 21:09:17 UTC (rev 6009)
+++ trunk/numpy/core/tests/test_umath.py	2008-11-11 21:57:01 UTC (rev 6010)
@@ -39,8 +39,7 @@
     def test_log2_values(self) :
         x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
         y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-        #for dt in ['f','d','g'] :
-        for dt in ['d'] :
+        for dt in ['f','d','g'] :
             xf = np.array(x, dtype=dt)
             yf = np.array(y, dtype=dt)
             assert_almost_equal(np.log2(xf), yf)
@@ -49,8 +48,7 @@
     def test_exp2_values(self) :
         x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
         y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-        #for dt in ['f','d','g'] :
-        for dt in ['d'] :
+        for dt in ['f','d','g'] :
             xf = np.array(x, dtype=dt)
             yf = np.array(y, dtype=dt)
             assert_almost_equal(np.exp2(yf), xf)
@@ -61,19 +59,17 @@
         x = [1, 2, 3, 4, 5]
         y = [5, 4, 3, 2, 1]
         z = [6, 6, 6, 6, 6]
-        #for dt, dec in zip(['f','d','g'],[6, 15, 15]) :
-        for dt, dec in zip(['d'],[15]) :
+        for dt, dec in zip(['f','d','g'],[6, 15, 15]) :
             xf = np.log2(np.array(x, dtype=dt))
             yf = np.log2(np.array(y, dtype=dt))
             zf = np.log2(np.array(z, dtype=dt))
             assert_almost_equal(np.logaddexp2(xf, yf), zf, decimal=dec)
 
     def test_logaddexp2_range(self) :
-        x = [1000000., -1000000., 1000200., -1000200.]
-        y = [1000200., -1000200., 1000000., -1000000.]
-        z = [1000200., -1000000., 1000200., -1000000.]
-        #for dt in ['f','d','g'] :
-        for dt in ['d'] :
+        x = [1000000, -1000000, 1000200, -1000200]
+        y = [1000200, -1000200, 1000000, -1000000]
+        z = [1000200, -1000000, 1000200, -1000000]
+        for dt in ['f','d','g'] :
             logxf = np.array(x, dtype=dt)
             logyf = np.array(y, dtype=dt)
             logzf = np.array(z, dtype=dt)
@@ -83,8 +79,7 @@
     def test_log_values(self) :
         x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
         y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-        #for dt in ['f','d','g'] :
-        for dt in ['d'] :
+        for dt in ['f','d','g'] :
             log2_ = 0.69314718055994530943
             xf = np.array(x, dtype=dt)
             yf = np.array(y, dtype=dt)*log2_
@@ -94,8 +89,7 @@
     def test_exp_values(self) :
         x = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
         y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-        #for dt in ['f','d','g'] :
-        for dt in ['d'] :
+        for dt in ['f','d','g'] :
             log2_ = 0.69314718055994530943
             xf = np.array(x, dtype=dt)
             yf = np.array(y, dtype=dt)*log2_
@@ -106,34 +100,23 @@
         x = [1, 2, 3, 4, 5]
         y = [5, 4, 3, 2, 1]
         z = [6, 6, 6, 6, 6]
-        #for dt, dec in zip(['f','d','g'],[6, 15, 15]) :
-        for dt, dec in zip(['d'],[15]) :
+        for dt, dec in zip(['f','d','g'],[6, 15, 15]) :
             xf = np.log(np.array(x, dtype=dt))
             yf = np.log(np.array(y, dtype=dt))
             zf = np.log(np.array(z, dtype=dt))
             assert_almost_equal(np.logaddexp(xf, yf), zf, decimal=dec)
 
     def test_logaddexp_range(self) :
-        x = [1000000., -1000000., 1000200., -1000200.]
-        y = [1000200., -1000200., 1000000., -1000000.]
-        z = [1000200., -1000000., 1000200., -1000000.]
-        #for dt in ['f','d','g'] :
-        for dt in ['d'] :
+        x = [1000000, -1000000, 1000200, -1000200]
+        y = [1000200, -1000200, 1000000, -1000000]
+        z = [1000200, -1000000, 1000200, -1000000]
+        for dt in ['f','d','g'] :
             logxf = np.array(x, dtype=dt)
             logyf = np.array(y, dtype=dt)
             logzf = np.array(z, dtype=dt)
             assert_almost_equal(np.logaddexp(logxf, logyf), logzf)
 
 class TestLog1p(TestCase):
-    def test_log1p_d(self):
-        np.log1p(np.array(1e-100, dtype='d'))
-
-    def test_log1p_f(self):
-        np.log1p(np.array(1e-100, dtype='f'))
-
-    def test_log1p_g(self):
-        np.log1p(np.array(1e-100, dtype='g'))
-
     def test_log1p(self):
         assert_almost_equal(ncu.log1p(0.2), ncu.log(1.2))
         assert_almost_equal(ncu.log1p(1e-6), ncu.log(1+1e-6))



More information about the Numpy-svn mailing list