diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-03-14 21:47:28 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2019-03-14 22:16:15 -0700 |
commit | 2829cc559d4887ab0fe86d4dce97c435009d1fd7 (patch) | |
tree | 9ea49bd2a7188f99e887a7eea94e0cb9ad3cd76f /numpy/polynomial/chebyshev.py | |
parent | 43c79ff448534e1d672e5c6013f9659d27d69aa0 (diff) | |
download | numpy-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/chebyshev.py')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 0eef90177..6fbdab065 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -583,15 +583,7 @@ def chebadd(c1, c2): array([4., 4., 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 chebsub(c1, c2): @@ -635,16 +627,7 @@ def chebsub(c1, c2): array([ 2., 0., -2.]) """ - # 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 chebmulx(c): |