Skip to content

Preconditioning in CG not working #41

Description

@surbainczyk

Hi,
I copied your code for the CG solver in pykrylov/cg/cg.py to use it in my own solver class. The CG solver was working just fine when used wthout a preconditioner. With a preconditioner, it failed to converge. Then I checked the code and saw that in pykrylov/cg/cg.py, in line 104, it should say p = -y, and in line 151, p -= y. Right now, only the unconditioned residual r is used in place of y.
Having changed that, everything worked fine again in my code (with and without preconditioner).

Thanks for sharing your solvers online! :) It's a great alternative when one doesn't want to try and understand the convoluted things SciPy is doing in their CG method...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions