GMRES with non-standard inner product

More
3 years 2 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.109 seconds