Krylov subspace polynomial of one right hand side, applied to another

Hello,

A Krylov subspace method (gmres, cg, minres,…) approximates the solution of a linear system, Ax=b. The solution at iteration n is a polynomial in A, applied to the right hand side b: x_n = P_n(A,b) b. Note that P_n depends on the rhs b.

Now I need to apply the same polynomial to another vector b', i.e., I want x'_n = P_n(A,b) b'.

Do you know of code that can do that? Or an easy way to hack the available code for iterative solvers?

I looked at some codes (IterativeSolvers, KrylovMethods, …) but could not figure out an easy (read lazy) way :slight_smile:

Any ideas?

Cheers!