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