diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-04-24 20:31:22 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-04-24 20:31:22 +0000 |
commit | 1a613e1c460d2e7756724b7e5c638c95519ee498 (patch) | |
tree | 31ce56bc09e829271899c784e70f6b2c80eeebbc /numpy/lib/polynomial.py | |
parent | 653d2b27fbe3771d7b669da0aec62a0cdb0654ac (diff) | |
download | numpy-1a613e1c460d2e7756724b7e5c638c95519ee498.tar.gz |
Fixed #1095: make polyint work well with object arrays
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r-- | numpy/lib/polynomial.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 5c3d146f8..fee498757 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -241,15 +241,14 @@ def polyint(p, m=1, k=None): "k must be a scalar or a rank-1 array of length 1 or >m." truepoly = isinstance(p, poly1d) - p = NX.asarray(p) + 0.0 + p = NX.asarray(p) if m == 0: if truepoly: return poly1d(p) return p else: - y = NX.zeros(len(p) + 1, p.dtype) - y[:-1] = p*1.0/NX.arange(len(p), 0, -1) - y[-1] = k[0] + # Note: this must work also with object and integer arrays + y = NX.concatenate((p.__truediv__(NX.arange(len(p), 0, -1)), [k[0]])) val = polyint(y, m - 1, k=k[1:]) if truepoly: return poly1d(val) |