diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-03-11 22:42:04 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2019-03-12 20:38:15 -0700 |
commit | fcea19a3dd586bbf9d62719de551ac75d3b4e17a (patch) | |
tree | 22fd41d0166b1a7dbe887ef3b09db9d5d5ad3f72 /numpy/polynomial/hermite.py | |
parent | 1bb279ad4f25d987155106ee6f82ba7fc83ce5a0 (diff) | |
download | numpy-fcea19a3dd586bbf9d62719de551ac75d3b4e17a.tar.gz |
MAINT: Unify polynomial valnd functions
No point writing the same function 12 times, when you can write it once
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r-- | numpy/polynomial/hermite.py | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 1dd2563bb..605cb29ad 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -981,14 +981,7 @@ def hermval2d(x, y, c): .. versionadded:: 1.7.0 """ - try: - x, y = np.array((x, y), copy=0) - except Exception: - raise ValueError('x, y are incompatible') - - c = hermval(x, c) - c = hermval(y, c, tensor=False) - return c + return pu._valnd(hermval, c, x, y) def hermgrid2d(x, y, c): @@ -1041,9 +1034,7 @@ def hermgrid2d(x, y, c): .. versionadded:: 1.7.0 """ - c = hermval(x, c) - c = hermval(y, c) - return c + return pu._gridnd(hermval, c, x, y) def hermval3d(x, y, z, c): @@ -1094,15 +1085,7 @@ def hermval3d(x, y, z, c): .. versionadded:: 1.7.0 """ - try: - x, y, z = np.array((x, y, z), copy=0) - except Exception: - raise ValueError('x, y, z are incompatible') - - c = hermval(x, c) - c = hermval(y, c, tensor=False) - c = hermval(z, c, tensor=False) - return c + return pu._valnd(hermval, c, x, y, z) def hermgrid3d(x, y, z, c): @@ -1158,10 +1141,7 @@ def hermgrid3d(x, y, z, c): .. versionadded:: 1.7.0 """ - c = hermval(x, c) - c = hermval(y, c) - c = hermval(z, c) - return c + return pu._gridnd(hermval, c, x, y, z) def hermvander(x, deg): |