def roll(P, shift, axis=None): A = P.A.copy() if P.dtype==f.frac: for key in P.keys: A[key] = f.roll(A[key], shift, axis) else: for key in P.keys: A[key] = np.roll(A[key], shift, axis) return Poly(A, P.dim, None, P.dtype)
def roll(P, shift, axis=None): A = P.A.copy() if P.dtype == f.frac: for key in P.keys: A[key] = f.roll(A[key], shift, axis) else: for key in P.keys: A[key] = np.roll(A[key], shift, axis) return Poly(A, P.dim, None, P.dtype)
def roll(A, shift, axis=None): if isinstance(A, (int, long, float, np.ndarray)): return np.roll(A, shift, axis) elif isinstance(A, f.frac): return f.roll(A, shift, axis) elif isinstance(A, p.Poly): return p.roll(A, shift, axis) raise NotImplementedError