From 1bb279ad4f25d987155106ee6f82ba7fc83ce5a0 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sat, 2 Mar 2019 15:44:25 -0800 Subject: MAINT: Move duplicate implementations of ABCPolyBase._fromroots into polyutils Every implementation is the same right now, other than calling different line / mul functions. Found by LGTM. --- numpy/polynomial/hermite.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'numpy/polynomial/hermite.py') diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 93c9fc564..1dd2563bb 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): -- cgit v1.2.1