From 2829cc559d4887ab0fe86d4dce97c435009d1fd7 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Thu, 14 Mar 2019 21:47:28 -0700 Subject: MAINT: Unify polynomial addition and subtraction functions These functions are all the same - the algorithm used does not care about the basis. --- numpy/polynomial/hermite.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'numpy/polynomial/hermite.py') diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 3767a80fc..5eabcfc66 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -326,15 +326,7 @@ def hermadd(c1, c2): array([2., 4., 6., 4.]) """ - # c1, c2 are trimmed copies - [c1, c2] = pu.as_series([c1, c2]) - if len(c1) > len(c2): - c1[:c2.size] += c2 - ret = c1 - else: - c2[:c1.size] += c1 - ret = c2 - return pu.trimseq(ret) + return pu._add(c1, c2) def hermsub(c1, c2): @@ -374,16 +366,7 @@ def hermsub(c1, c2): array([0., 0., 0., 4.]) """ - # c1, c2 are trimmed copies - [c1, c2] = pu.as_series([c1, c2]) - if len(c1) > len(c2): - c1[:c2.size] -= c2 - ret = c1 - else: - c2 = -c2 - c2[:c1.size] += c1 - ret = c2 - return pu.trimseq(ret) + return pu._sub(c1, c2) def hermmulx(c): -- cgit v1.2.1