GMRES with non-standard inner product

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)
    

[/code]

best,
Alex