# [Scipy-svn] r5330 - in trunk/scipy/special: . tests

scipy-svn@scip... scipy-svn@scip...
Tue Jan 6 03:52:37 CST 2009

```Author: stefan
Date: 2009-01-06 03:51:38 -0600 (Tue, 06 Jan 2009)
New Revision: 5330

Modified:
trunk/scipy/special/basic.py
trunk/scipy/special/tests/test_basic.py
Log:
Use correct shape in scipy.special.lqmn.  Fixes #804.

Modified: trunk/scipy/special/basic.py
===================================================================
--- trunk/scipy/special/basic.py	2009-01-06 09:27:50 UTC (rev 5329)
+++ trunk/scipy/special/basic.py	2009-01-06 09:51:38 UTC (rev 5330)
@@ -529,9 +529,11 @@
raise ValueError, "z must be scalar."
m = int(m)
n = int(n)
-    if (m*n == 0):
-        mm = max(1,m)
-        nn = max(1,n)
+
+    # Ensure neither m nor n == 0
+    mm = max(1,m)
+    nn = max(1,n)
+
if iscomplex(z):
q,qd = specfun.clqmn(mm,nn,z)
else:

Modified: trunk/scipy/special/tests/test_basic.py
===================================================================
--- trunk/scipy/special/tests/test_basic.py	2009-01-06 09:27:50 UTC (rev 5329)
+++ trunk/scipy/special/tests/test_basic.py	2009-01-06 09:51:38 UTC (rev 5330)
@@ -1739,6 +1739,15 @@
assert_array_almost_equal(lqmnf[0][0],lqf[0],4)
assert_array_almost_equal(lqmnf[1][0],lqf[1],4)

+    def test_lqmn_shape(self):
+        a, b = lqmn(4, 4, 1.1)
+        assert_equal(a.shape, (5, 5))
+        assert_equal(b.shape, (5, 5))
+
+        a, b = lqmn(4, 0, 1.1)
+        assert_equal(a.shape, (5, 1))
+        assert_equal(b.shape, (5, 1))
+
def test_lqn(self):
lqf = lqn(2,.5)
assert_array_almost_equal(lqf,(array([ 0.5493, -0.7253, -0.8187]),

```