Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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
Esempio n. 4
0
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