diff options
author | cookedm <cookedm@localhost> | 2007-06-01 19:29:37 +0000 |
---|---|---|
committer | cookedm <cookedm@localhost> | 2007-06-01 19:29:37 +0000 |
commit | 6f509f626355208b3cb97e692daf52c3734769cd (patch) | |
tree | e8ebc99585e3bc19722ed91e873cc8a6b7807cd5 /numpy/lib/polynomial.py | |
parent | e11e876cb485269eb18baa0a58cf3009584a354a (diff) | |
download | numpy-6f509f626355208b3cb97e692daf52c3734769cd.tar.gz |
add __neg__ and __pos__ methods to poly1d
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r-- | numpy/lib/polynomial.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 6964277a3..edaa319cd 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -547,6 +547,12 @@ class poly1d(object): 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) |