gpt icon indicating copy to clipboard operation
gpt copied to clipboard

add preconditioned CG

Open krox opened this issue 4 years ago • 0 comments

add an (optional) preconditioner to CG. I have implemented as part of the existing cg class instead of a new class to reduce code-duplication. Running CG on a matrix M with preconditioner P is equivalent to running normal CG on the problem (E^-1)^dag * M * E^-1 where E^dag * E = P. But the matrix E is never needed in isolation, only P (or rather P^-1).

gpt.algorithms.inverter.preconditioned already allows arbitrary preconditioners of the form L* M * R + S for any matrices L,M,S. But both L and R need both be actually exist separately, which can be quite inconvenient.

My usecase (if anyone cares): Wilson-Clover fermions have the form "M=Clover+Hopping". When running nf=2 simulations, I need to invert "M^dag M". The simplest preconditioner for that operator consists simply of the site-local part of "M^dag M", which turns out to be "C^dag C + 4" (the "+4" comes from the "H^dag H" term). In order to use gpt.algorithms.inverter.preconditioned, I would need to compute the square-root of that operator, which is not needed when using preconditioned CG directly. (just setting "L=(C^dag C+4)^-1" and "R=1" is not an option either, because that would destroy self-adjointness and make CG unusable altogether)

krox avatar Mar 11 '21 16:03 krox