summaryrefslogtreecommitdiff
path: root/numpy/polynomial/hermite.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-03-14 21:47:28 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-03-14 22:16:15 -0700
commit2829cc559d4887ab0fe86d4dce97c435009d1fd7 (patch)
tree9ea49bd2a7188f99e887a7eea94e0cb9ad3cd76f /numpy/polynomial/hermite.py
parent43c79ff448534e1d672e5c6013f9659d27d69aa0 (diff)
downloadnumpy-2829cc559d4887ab0fe86d4dce97c435009d1fd7.tar.gz
MAINT: Unify polynomial addition and subtraction functions
These functions are all the same - the algorithm used does not care about the basis.
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r--numpy/polynomial/hermite.py21
1 files changed, 2 insertions, 19 deletions
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):