[Scipy-svn] r6971 - in trunk/scipy/special: specfun tests

scipy-svn@scip... scipy-svn@scip...
Sun Nov 28 17:08:19 CST 2010


Author: ptvirtan
Date: 2010-11-28 17:08:19 -0600 (Sun, 28 Nov 2010)
New Revision: 6971

Modified:
   trunk/scipy/special/specfun/specfun.f
   trunk/scipy/special/tests/test_basic.py
Log:
BUG: special: fix < vs <= error in lpmv

Modified: trunk/scipy/special/specfun/specfun.f
===================================================================
--- trunk/scipy/special/specfun/specfun.f	2010-11-28 22:55:42 UTC (rev 6970)
+++ trunk/scipy/special/specfun/specfun.f	2010-11-28 23:08:19 UTC (rev 6971)
@@ -7893,7 +7893,7 @@
            VX=-VX-1
         ENDIF
         NEG_M=0
-        IF (M.LT.0.AND.(VX+M+1).GE.0D0) THEN
+        IF (M.LT.0.AND.(VX+M+1).GT.0D0) THEN
 C          XXX: does not handle the cases where AMS 8.2.5
 C               does not help
            NEG_M=1

Modified: trunk/scipy/special/tests/test_basic.py
===================================================================
--- trunk/scipy/special/tests/test_basic.py	2010-11-28 22:55:42 UTC (rev 6970)
+++ trunk/scipy/special/tests/test_basic.py	2010-11-28 23:08:19 UTC (rev 6971)
@@ -1888,6 +1888,11 @@
         lp = special.lpmv(0,40,.001)
         assert_almost_equal(lp,0.1252678976534484,7)
 
+        # XXX: this is outside the domain of the current implementation,
+        #      so ensure it returns a NaN rather than a wrong answer.
+        lp = special.lpmv(-1,-1,.001)
+        assert_(lp != 0 or np.isnan(lp))
+
     def test_lqmn(self):
         lqmnf = special.lqmn(0,2,.5)
         lqmnf = special.lqmn(0,2,.5)



More information about the Scipy-svn mailing list