diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-03-02 15:44:25 -0800 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2019-03-11 22:26:43 -0700 |
commit | 1bb279ad4f25d987155106ee6f82ba7fc83ce5a0 (patch) | |
tree | d5bc7027dd67bc96f06da27af3211d1cc2693bc7 /numpy/polynomial/hermite.py | |
parent | 379995dcc10fd9c58336420bd995b6d8a1b61288 (diff) | |
download | numpy-1bb279ad4f25d987155106ee6f82ba7fc83ce5a0.tar.gz |
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.
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r-- | numpy/polynomial/hermite.py | 16 |
1 files changed, 1 insertions, 15 deletions
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): |