Add support for damp in CG
Motivation
The CG solver currently implements x=A^-1b. We may however also solver x=(A+dampI)^-1b. This is however currently not implemented.
Note that damp is currently present as input values but never used and the docstring mentions it will be deprecated in v2
Definition of done
- Added implementation with
damp!=0
@mrava87 I would like to work on this
Note that we have removed damp from this solver in v2. We could of course re-introduce it and implement it. Are you familiar with CG solver at all?
From what i can understand, we have to add dampening at each iteration. I would add the dampning factor to the solve method
self.c = self.r + b * self.c to self.c = self.r + b * self.c * (1 - self.damp).
Would the damp be same as CGLS solver (self.damp = damp**2) or something else?
Yea it is (at least it has the same meaning). Basically you want to solve (A+dampI)x=y instead of Ax=y.
But I don’t think it’s correct to add it where you suggest… in general you can try to add damp*Identity to your operator A (say a MatrixMult) and use damp=0 in the solver versus using damp in the solver after making changes… the two should give the same result :)