class _PowerLinearOperator(LinearOperator):
def __init__(self, A, p):
if not isinstance(A, LinearOperator):
raise ValueError("LinearOperator expected as A")
if A.shape[0] != A.shape[1]:
raise ValueError("square LinearOperator expected, got %r" % A)
if not isintlike(p):
raise ValueError("integer expected as p")
self.args = (A, p)
self.dtype = _get_dtype([A])self.shape = A.shape
def _power(self, fun, x):
res = np.array(x, copy=True)
for i in range(self.args[1]):