pylops icon indicating copy to clipboard operation
pylops copied to clipboard

Add support for damp in CG

Open mrava87 opened this issue 3 years ago • 4 comments

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 avatar Jun 29 '22 12:06 mrava87

@mrava87 I would like to work on this

dikwickley avatar Feb 07 '23 16:02 dikwickley

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?

mrava87 avatar Feb 07 '23 16:02 mrava87

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?

dikwickley avatar Feb 15 '23 19:02 dikwickley

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 :)

mrava87 avatar Feb 15 '23 19:02 mrava87