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