Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

GMRES with non-standard inner product

More
2 years 6 months ago #4029 by arieder
Hi,

today I tried to use your GMRES solver with a custom inner product, but this appears to be a poorly tested codepath. Namely, there is a typo in the constructor, self.restart is not set and after the restart the new inner product is not forwarded.

Namely, I had to make the following changes to make it work:
Code:
diff --git a/home/alex/devel/src/ngsolve/python/krylovspace.py b/krylovspace.py index ea97030..e9d88ce 100644 --- a/home/alex/devel/src/ngsolve/python/krylovspace.py +++ b/krylovspace.py @@ -713,8 +713,9 @@ restart : int = None **kwargs): super().__init__(*args, **kwargs) if innerproduct is not None: - self.innnerproduct = innerproduct + self.innerproduct = innerproduct self.norm = lambda x: sqrt(innerproduct(x,x).real) + self.restart = restart else: self.innerproduct = lambda x, y: y.InnerProduct(x, conjugate=True) self.norm = Norm @@ -820,6 +821,7 @@ restart : int = None callback_sol=self.callback_sol, maxiter=self.maxiter, restart=self.restart, + innerproduct=self.innerproduct, printrates=self.printrates) restarted_solver.iterations = self.iterations sol = restarted_solver.Solve(rhs = rhs, sol = sol, initialize=False)

best,
Alex
Time to create page: 0.136 seconds