summaryrefslogtreecommitdiff
path: root/numpy/polynomial/hermite.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-03-16 20:38:50 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-03-16 21:08:44 -0700
commitddbc31c2d71285f426dc16fab8ac2e00ffe6c1f8 (patch)
treea4f4a4e73eb900d1294ee56dd867da5143aeed31 /numpy/polynomial/hermite.py
parent0764929543c85decde9d664367dbf7d8f137fe1f (diff)
downloadnumpy-ddbc31c2d71285f426dc16fab8ac2e00ffe6c1f8.tar.gz
MAINT: Unify polynomial power functions
These power functions are all the same - the algorithm used does not care about the basis. `polypow` and `chebpow` have some optimizations in their versions, which this maintains
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r--numpy/polynomial/hermite.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py
index e925c4304..1f9f07d29 100644
--- a/numpy/polynomial/hermite.py
+++ b/numpy/polynomial/hermite.py
@@ -570,24 +570,7 @@ def hermpow(c, pow, maxpower=16):
array([81., 52., 82., 12., 9.])
"""
- # c is a trimmed copy
- [c] = pu.as_series([c])
- power = int(pow)
- if power != pow or power < 0:
- raise ValueError("Power must be a non-negative integer.")
- elif maxpower is not None and power > maxpower:
- raise ValueError("Power is too large")
- elif power == 0:
- return np.array([1], dtype=c.dtype)
- elif power == 1:
- return c
- else:
- # This can be made more efficient by using powers of two
- # in the usual way.
- prd = c
- for i in range(2, power + 1):
- prd = hermmul(prd, c)
- return prd
+ return pu._pow(hermmul, c, pow, maxpower)
def hermder(c, m=1, scl=1, axis=0):