Skip to content

Commit

Permalink
Fixed the iterate bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaretDuff committed Sep 18, 2023
1 parent 0710893 commit e5cc8c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions Wrappers/Python/cil/optimisation/operators/Operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Wrappers/Python/test/test_BlockOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e5cc8c1

Please sign in to comment.