diff options
author | Nico Schlömer <nico.schloemer@gmail.com> | 2017-08-11 03:01:06 +0200 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-08-10 20:01:06 -0500 |
commit | 029863eae86b9df2de4b9a9843ca8f88c99130df (patch) | |
tree | ced3f88544979e2dc6f7eb327963c5d2688374ef /numpy/polynomial | |
parent | 4c18530b1e3e428a3755c6847f70322ec12bdbc2 (diff) | |
download | numpy-029863eae86b9df2de4b9a9843ca8f88c99130df.tar.gz |
MAINT: Use moveaxis instead of rollaxis internally (#9475)
Also add a hint to the documentation advising the use of moveaxis over rollaxis.
Tests for rollaxis are left alone.
Diffstat (limited to 'numpy/polynomial')
-rw-r--r-- | numpy/polynomial/chebyshev.py | 10 | ||||
-rw-r--r-- | numpy/polynomial/hermite.py | 10 | ||||
-rw-r--r-- | numpy/polynomial/hermite_e.py | 10 | ||||
-rw-r--r-- | numpy/polynomial/laguerre.py | 10 | ||||
-rw-r--r-- | numpy/polynomial/legendre.py | 10 | ||||
-rw-r--r-- | numpy/polynomial/polynomial.py | 10 |
6 files changed, 30 insertions, 30 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py index b28ea0462..eb9797e0f 100644 --- a/numpy/polynomial/chebyshev.py +++ b/numpy/polynomial/chebyshev.py @@ -944,7 +944,7 @@ def chebder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -960,7 +960,7 @@ def chebder(c, m=1, scl=1, axis=0): der[1] = 4*c[2] der[0] = c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1069,7 +1069,7 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -1088,7 +1088,7 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j - 1] -= c[j]/(2*(j - 1)) tmp[0] += k[i] - chebval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1460,7 +1460,7 @@ def chebvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = v[i-1]*x2 - v[i-2] - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def chebvander2d(x, y, deg): diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index ccf0fc146..856ac487e 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -706,7 +706,7 @@ def hermder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -718,7 +718,7 @@ def hermder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = (2*j)*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -825,7 +825,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -840,7 +840,7 @@ def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(2*(j + 1)) tmp[0] += k[i] - hermval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1229,7 +1229,7 @@ def hermvander(x, deg): v[1] = x2 for i in range(2, ideg + 1): v[i] = (v[i-1]*x2 - v[i-2]*(2*(i - 1))) - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def hermvander2d(x, y, deg): diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py index 2fafea4af..e83b26327 100644 --- a/numpy/polynomial/hermite_e.py +++ b/numpy/polynomial/hermite_e.py @@ -705,7 +705,7 @@ def hermeder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: return c[:1]*0 @@ -717,7 +717,7 @@ def hermeder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = j*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -824,7 +824,7 @@ def hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -839,7 +839,7 @@ def hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(j + 1) tmp[0] += k[i] - hermeval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1226,7 +1226,7 @@ def hermevander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = (v[i-1]*x - v[i-2]*(i - 1)) - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def hermevander2d(x, y, deg): diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py index 387d986fa..60373b8c8 100644 --- a/numpy/polynomial/laguerre.py +++ b/numpy/polynomial/laguerre.py @@ -703,7 +703,7 @@ def lagder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -717,7 +717,7 @@ def lagder(c, m=1, scl=1, axis=0): c[j - 1] += c[j] der[0] = -c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -825,7 +825,7 @@ def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -841,7 +841,7 @@ def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = -c[j] tmp[0] += k[i] - lagval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1228,7 +1228,7 @@ def lagvander(x, deg): v[1] = 1 - x for i in range(2, ideg + 1): v[i] = (v[i-1]*(2*i - 1 - x) - v[i-2]*(i - 1))/i - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def lagvander2d(x, y, deg): diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py index d4b4dd130..5128643cd 100644 --- a/numpy/polynomial/legendre.py +++ b/numpy/polynomial/legendre.py @@ -742,7 +742,7 @@ def legder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -758,7 +758,7 @@ def legder(c, m=1, scl=1, axis=0): der[1] = 3*c[2] der[0] = c[1] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -867,7 +867,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) k = list(k) + [0]*(cnt - len(k)) for i in range(cnt): n = len(c) @@ -886,7 +886,7 @@ def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j - 1] -= t tmp[0] += k[i] - legval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1259,7 +1259,7 @@ def legvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = (v[i-1]*x*(2*i - 1) - v[i-2]*(i - 1))/i - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def legvander2d(x, y, deg): diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py index 4b343bf7d..1528de342 100644 --- a/numpy/polynomial/polynomial.py +++ b/numpy/polynomial/polynomial.py @@ -546,7 +546,7 @@ def polyder(c, m=1, scl=1, axis=0): if cnt == 0: return c - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) n = len(c) if cnt >= n: c = c[:1]*0 @@ -558,7 +558,7 @@ def polyder(c, m=1, scl=1, axis=0): for j in range(n, 0, -1): der[j - 1] = j*c[j] c = der - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -662,7 +662,7 @@ def polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0): return c k = list(k) + [0]*(cnt - len(k)) - c = np.rollaxis(c, iaxis) + c = np.moveaxis(c, iaxis, 0) for i in range(cnt): n = len(c) c *= scl @@ -676,7 +676,7 @@ def polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0): tmp[j + 1] = c[j]/(j + 1) tmp[0] += k[i] - polyval(lbnd, tmp) c = tmp - c = np.rollaxis(c, 0, iaxis + 1) + c = np.moveaxis(c, 0, iaxis) return c @@ -1147,7 +1147,7 @@ def polyvander(x, deg): v[1] = x for i in range(2, ideg + 1): v[i] = v[i-1]*x - return np.rollaxis(v, 0, v.ndim) + return np.moveaxis(v, 0, -1) def polyvander2d(x, y, deg): |