[Numpy-svn] r3895 - in trunk/numpy: core/tests lib

numpy-svn@scip... numpy-svn@scip...
Tue Jul 24 02:46:33 CDT 2007


Author: stefan
Date: 2007-07-24 02:46:07 -0500 (Tue, 24 Jul 2007)
New Revision: 3895

Modified:
   trunk/numpy/core/tests/test_regression.py
   trunk/numpy/lib/polynomial.py
Log:
Fix polygon division. Closes ticket #553.


Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2007-07-24 07:33:28 UTC (rev 3894)
+++ trunk/numpy/core/tests/test_regression.py	2007-07-24 07:46:07 UTC (rev 3895)
@@ -702,6 +702,13 @@
         from numpy.oldnumeric.random_array import randint
         randint(0,50,[2,3])
 
+    def check_poly_div(self, level=rlevel):
+        """Ticket #553"""
+        u = N.poly1d([1,2,3])
+        v = N.poly1d([1,2,3,4,5])
+        q,r = N.polydiv(u,v)
+        assert_equal(q*v + r, u)
+
     def check_poly_eq(self, level=rlevel):
         """Ticket #554"""
         x = N.poly1d([1,2,3])

Modified: trunk/numpy/lib/polynomial.py
===================================================================
--- trunk/numpy/lib/polynomial.py	2007-07-24 07:33:28 UTC (rev 3894)
+++ trunk/numpy/lib/polynomial.py	2007-07-24 07:46:07 UTC (rev 3895)
@@ -400,7 +400,7 @@
     m = len(u) - 1
     n = len(v) - 1
     scale = 1. / v[0]
-    q = NX.zeros((m-n+1,), float)
+    q = NX.zeros((max(m-n+1,1),), float)
     r = u.copy()
     for k in range(0, m-n+1):
         d = scale * r[k]



More information about the Numpy-svn mailing list