Coverage for /usr/share/miniconda3/envs/dolfin/lib/python3.8/site-packages/block/iterative/richardson.py: 83%
18 statements
« prev ^ index » next coverage.py v7.2.1, created at 2023-03-20 13:03 +0000
« prev ^ index » next coverage.py v7.2.1, created at 2023-03-20 13:03 +0000
1from __future__ import division
2from .common import *
4def richardson(B, A, x, b, tolerance, maxiter, progress, relativeconv=False,
5 callback=None):
7 residuals = []
9 r = b - A*x
10 residuals = [sqrt(inner(r,r))]
12 if relativeconv: 12 ↛ 13line 12 didn't jump to line 13, because the condition on line 12 was never true
13 tolerance *= residuals[0]
15 iter = 0
16 while residuals[-1] > tolerance and iter < maxiter:
17 x += B*r
18 r = b - A*x
20 residuals.append(sqrt(inner(r,r)))
21 if callable(callback): 21 ↛ 22line 21 didn't jump to line 22, because the condition on line 21 was never true
22 callback(iter, x, residuals[-1])
24 iter += 1
25 progress += 1
27 return x, residuals, [], []