Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fom #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix fom #137

wants to merge 1 commit into from

Conversation

gnrraphi
Copy link
Contributor

Calculation of Krylov basis after restart was wrong. See, e.g., vector $v_1$ of ALGORITHM 6.5 of https://www-users.cse.umn.edu/~saad/IterMethBook_2ndEd.pdf.

This can be seen by running

import gpt as g

# load configuration
precision = g.double
rng = g.random("test")
U = g.qcd.gauge.random(g.grid([4, 4, 4, 8], precision), rng)

# use the gauge configuration grid
grid = U[0].grid

# quark
w = g.qcd.fermion.wilson_clover(
    U,
    {
        "kappa": 0.13565,
        "csw_r": 2.0171 / 2.0,
        "csw_t": 2.0171 / 2.0,
        "xi_0": 1,
        "nu": 1,
        "isAnisotropic": False,
        "boundary_phases": [1.0, 1.0, 1.0, 1.0],
    },
)

# create point source
src = g.vspincolor(grid)
src[:] = 0
src[0, 1, 0, 0] = g.vspincolor([[1] * 3] * 4)

# solver
inv = g.algorithms.inverter
fom = inv.fom({"eps": 1e-6, "maxiter": 1000, "restartlen": 20})(w)

dst = g.eval(fom * src)

# Output before pull request
# fom: NOT converged in 1000 iterations;
# computed squared residual 2.433503e-07 / 1.200000e-11;
# true squared residual 3.202319e+00 / 1.200000e-11

# Output after pull request
# fom: NOT converged in 1000 iterations;
# computed squared residual 2.433503e-07 / 1.200000e-11;
# true squared residual 2.433503e-07 / 1.200000e-11

and compare computed squared residual and true squared residual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant