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

SOR bug #410

Open
lukeolson opened this issue May 22, 2024 · 1 comment · May be fixed by #413
Open

SOR bug #410

lukeolson opened this issue May 22, 2024 · 1 comment · May be fixed by #413
Assignees

Comments

@lukeolson
Copy link
Member

From the example on wikipedia:
https://en.wikipedia.org/wiki/Successive_over-relaxation#Example

A = np.array([[ 4, -1, -6,  0],
              [-5, -4, 10,  8],
              [ 0,  9,  4, -2],
              [ 1,  0, -7,  5.]])
b = np.array([2, 21, -12, -6.])
x = np.array([0, 0, 0, 0.])

pyamg.relaxation.relaxation.sor(A, x, b, 0.5, iterations=1)
print(x)

gives

[ 0.25     -2.9375    5.109375  6.503125]

whereas the first iteration should be

[0.25  −2.78125  1.6289062  0.5152344]
@lukeolson lukeolson self-assigned this May 22, 2024
Sushmey added a commit to Sushmey/pyamg that referenced this issue Jun 1, 2024
fixes pyamg#410

SOR right now fails to include previous x_i values with the relaxation factor. This commit fixes that.
@Sushmey Sushmey linked a pull request Jun 1, 2024 that will close this issue
@Sushmey
Copy link

Sushmey commented Jun 1, 2024

I think the discrepancy is because the Gauss-Seidel iteration being used internally in SOR doesn't consider the relaxation factor while calculating the next x_i. It just processes the whole matrix without the relaxation factor.

I've tried to resolve this with a commit and I'll make the PR referencing this issue.

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 a pull request may close this issue.

2 participants