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/chebyshev.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/chebyshev.py')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index 70527ec79..8eb365de7 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -1224,14 +1224,7 @@ def chebval2d(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 = chebval(x, c) - c = chebval(y, c, tensor=False) - return c + return pu._valnd(chebval, c, x, y) def chebgrid2d(x, y, c): @@ -1284,9 +1277,7 @@ def chebgrid2d(x, y, c): .. versionadded:: 1.7.0 """ - c = chebval(x, c) - c = chebval(y, c) - return c + return pu._gridnd(chebval, c, x, y) def chebval3d(x, y, z, c): @@ -1337,15 +1328,7 @@ def chebval3d(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 = chebval(x, c) - c = chebval(y, c, tensor=False) - c = chebval(z, c, tensor=False) - return c + return pu._valnd(chebval, c, x, y, z) def chebgrid3d(x, y, z, c): @@ -1401,10 +1384,7 @@ def chebgrid3d(x, y, z, c): .. versionadded:: 1.7.0 """ - c = chebval(x, c) - c = chebval(y, c) - c = chebval(z, c) - return c + return pu._gridnd(chebval, c, x, y, z) def chebvander(x, deg): |