diff options
-rwxr-xr-x | Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py | 5 | ||||
-rwxr-xr-x | Wrappers/Python/test/test_algorithms.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py b/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py index 5a8341e..d3aea8e 100755 --- a/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py +++ b/Wrappers/Python/ccpi/optimisation/algorithms/CGLS.py @@ -115,6 +115,9 @@ class CGLS(Algorithm): if flag: self.update_objective() - print (self.verbose_output()) + if self.iteration > self._iteration[-1]: + print (self.verbose_output()) + print('Tolerance is reached: {}'.format(self.tolerance)) + return flag diff --git a/Wrappers/Python/test/test_algorithms.py b/Wrappers/Python/test/test_algorithms.py index 3bb3d57..4bcc95a 100755 --- a/Wrappers/Python/test/test_algorithms.py +++ b/Wrappers/Python/test/test_algorithms.py @@ -72,7 +72,7 @@ class TestAlgorithms(unittest.TestCase): identity = Identity(ig) alg = CGLS(x_init=x_init, operator=identity, data=b) - alg.max_iteration = 1 + alg.max_iteration = 200 alg.run(20, verbose=True) self.assertNumpyArrayAlmostEqual(alg.x.as_array(), b.as_array()) |