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