summaryrefslogtreecommitdiff
path: root/numpy/polynomial/hermite.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2019-03-12 20:07:38 -0600
committerGitHub <noreply@github.com>2019-03-12 20:07:38 -0600
commit35a905f85e6efef6d3292103e151dc3002c72406 (patch)
tree68b886f0e1d033b365ca4d956082a975967be25e /numpy/polynomial/hermite.py
parentd34d1f3c035f60ee80212b68b642ab648bd4252b (diff)
parent1bb279ad4f25d987155106ee6f82ba7fc83ce5a0 (diff)
downloadnumpy-35a905f85e6efef6d3292103e151dc3002c72406.tar.gz
Merge pull request #13078 from eric-wieser/simplify-from-roots
MAINT: deduplicate fromroots in np.polynomial
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r--numpy/polynomial/hermite.py16
1 files changed, 1 insertions, 15 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py
index f3e55f6e8..80cbbef0b 100644
--- a/numpy/polynomial/hermite.py
+++ b/numpy/polynomial/hermite.py
@@ -286,21 +286,7 @@ def hermfromroots(roots):
array([0.+0.j, 0.+0.j])
"""
- if len(roots) == 0:
- return np.ones(1)
- else:
- [roots] = pu.as_series([roots], trim=False)
- roots.sort()
- p = [hermline(-r, 1) for r in roots]
- n = len(p)
- while n > 1:
- m, r = divmod(n, 2)
- tmp = [hermmul(p[i], p[i+m]) for i in range(m)]
- if r:
- tmp[0] = hermmul(tmp[0], p[-1])
- p = tmp
- n = m
- return p[0]
+ return pu._fromroots(hermline, hermmul, roots)
def hermadd(c1, c2):