MCPcopy Create free account
hub / github.com/chunleili/mgpbd / V_cycle_v2

Method V_cycle_v2

engine/solver/amg_python.py:162–179  ·  view source on GitHub ↗
(self, levels, x0, b)

Source from the content-addressed store, hash-verified

160
161 # non recursive V_cycle norecur
162 def V_cycle_v2(self, levels, x0, b):
163 nl = len(levels)
164 levels[0].r=b
165 levels[0].x=x0
166
167 for l in range(nl - 1):
168 A = levels[l].A
169 levels[l].x = np.zeros(shape=A.shape[0], dtype=A.dtype)
170 self.presmoother(A, levels[l].x, levels[l].r)
171 levels[l+1].r = levels[l].R @ (levels[l].r - A @ levels[l].x)
172
173 levels[nl-1].x = self.coarse_solver(levels[nl-1].A, levels[nl-1].r)
174
175 for l in reversed(range(nl - 1)):
176 levels[l].x += levels[l].P @ levels[l+1].x
177 self.postsmoother(levels[l].A, levels[l].x, levels[l].r)
178
179 return levels[0].x
180
181
182 def old_amg_cg_solve(self, levels, b, x0=None, tol=1e-5, maxiter=100):

Callers 1

psolveMethod · 0.95

Calls 3

presmootherMethod · 0.95
coarse_solverMethod · 0.95
postsmootherMethod · 0.95

Tested by

no test coverage detected