summaryrefslogtreecommitdiff
path: root/numpy/polynomial/hermite.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-03-12 22:45:16 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-03-12 23:13:59 -0700
commit43c79ff448534e1d672e5c6013f9659d27d69aa0 (patch)
tree89d9b63028478412663a8ecbe881a7783e681516 /numpy/polynomial/hermite.py
parenta9790fe223a15419c68aa1dd6ee6ab45ad4b96c8 (diff)
downloadnumpy-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.py')
-rw-r--r--numpy/polynomial/hermite.py21
1 files changed, 1 insertions, 20 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py
index 605cb29ad..3767a80fc 100644
--- a/numpy/polynomial/hermite.py
+++ b/numpy/polynomial/hermite.py
@@ -550,26 +550,7 @@ def hermdiv(c1, c2):
(array([1., 2., 3.]), array([1., 1.]))
"""
- # 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 = hermmul([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(hermmul, c1, c2)
def hermpow(c, pow, maxpower=16):