diff --git a/Wrappers/Python/cil/optimisation/operators/Operator.py b/Wrappers/Python/cil/optimisation/operators/Operator.py index 8da95c6e73..8944441809 100644 --- a/Wrappers/Python/cil/optimisation/operators/Operator.py +++ b/Wrappers/Python/cil/optimisation/operators/Operator.py @@ -225,11 +225,9 @@ def PowerMethod(operator, max_iteration=10, initial=None, tolerance=1e-5, retur diff = numpy.finfo('d').max i = 0 while (i < max_iteration and diff > tolerance): - i+=1 operator.direct(x0, out = y_tmp) - - + if square: #swap datacontainer references tmp = x0 diff --git a/Wrappers/Python/test/test_BlockOperator.py b/Wrappers/Python/test/test_BlockOperator.py index bff62cd5af..adfac71572 100644 --- a/Wrappers/Python/test/test_BlockOperator.py +++ b/Wrappers/Python/test/test_BlockOperator.py @@ -187,9 +187,8 @@ def test_FiniteDiffOperator(self): G = FiniteDifferenceOperator(ig, direction=0, bnd_cond = 'Neumann') logging.info("{} {}".format(type(u), str(u.as_array()))) logging.info(str(G.direct(u).as_array())) - LinearOperator.PowerMethod(G, range_is_domain=False) # Gradient Operator norm, for one direction should be close to 2 - numpy.testing.assert_allclose(LinearOperator.PowerMethod(G, range_is_domain=False), numpy.sqrt(4), atol=0.1) + numpy.testing.assert_allclose(G.norm(), numpy.sqrt(4), atol=0.1) M1, N1, K1 = 200, 300, 2 ig1 = ImageGeometry(voxel_num_x = M1, voxel_num_y = N1, channels = K1)