[Numpy-svn] r3857 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Fri Jun 1 14:29:40 CDT 2007


Author: cookedm
Date: 2007-06-01 14:29:37 -0500 (Fri, 01 Jun 2007)
New Revision: 3857

Modified:
   trunk/numpy/lib/polynomial.py
Log:
add __neg__ and __pos__ methods to poly1d

Modified: trunk/numpy/lib/polynomial.py
===================================================================
--- trunk/numpy/lib/polynomial.py	2007-06-01 13:57:24 UTC (rev 3856)
+++ trunk/numpy/lib/polynomial.py	2007-06-01 19:29:37 UTC (rev 3857)
@@ -547,6 +547,12 @@
     def __call__(self, val):
         return polyval(self.coeffs, val)
 
+    def __neg__(self):
+        return poly1d(-self.coeffs)
+
+    def __pos__(self):
+        return self
+
     def __mul__(self, other):
         if isscalar(other):
             return poly1d(self.coeffs * other)



More information about the Numpy-svn mailing list