diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-03-12 22:45:16 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2019-03-12 23:13:59 -0700 |
commit | 43c79ff448534e1d672e5c6013f9659d27d69aa0 (patch) | |
tree | 89d9b63028478412663a8ecbe881a7783e681516 /numpy/polynomial/hermite_e.py | |
parent | a9790fe223a15419c68aa1dd6ee6ab45ad4b96c8 (diff) | |
download | numpy-43c79ff448534e1d672e5c6013f9659d27d69aa0.tar.gz |
MAINT: Unify polynomial division functions
These division functions are all the same - the algorithm used does not care about the basis.
Note that while chebdiv and polydiv could be implemented in terms of this function, their current implementations are more optimal and exploit the properties of a multiplication by a basis polynomial.
Diffstat (limited to 'numpy/polynomial/hermite_e.py')
-rw-r--r-- | numpy/polynomial/hermite_e.py | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py index b28881013..228396457 100644 --- a/numpy/polynomial/hermite_e.py +++ b/numpy/polynomial/hermite_e.py @@ -545,26 +545,7 @@ def hermediv(c1, c2): (array([1., 2., 3.]), array([1., 2.])) """ - # c1, c2 are trimmed copies - [c1, c2] = pu.as_series([c1, c2]) - if c2[-1] == 0: - raise ZeroDivisionError() - - lc1 = len(c1) - lc2 = len(c2) - if lc1 < lc2: - return c1[:1]*0, c1 - elif lc2 == 1: - return c1/c2[-1], c1[:1]*0 - else: - quo = np.empty(lc1 - lc2 + 1, dtype=c1.dtype) - rem = c1 - for i in range(lc1 - lc2, - 1, -1): - p = hermemul([0]*i + [1], c2) - q = rem[-1]/p[-1] - rem = rem[:-1] - q*p[:-1] - quo[i] = q - return quo, pu.trimseq(rem) + return pu._div(hermemul, c1, c2) def hermepow(c, pow, maxpower=16): |