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

Typo in anderson_acceleration.py ? #2

Closed
henrymai opened this issue Oct 29, 2021 · 3 comments
Closed

Typo in anderson_acceleration.py ? #2

henrymai opened this issue Oct 29, 2021 · 3 comments

Comments

@henrymai
Copy link
Contributor

henrymai commented Oct 29, 2021

gamma = torch.linalg.lstsq(DR, R[:, -1]).solution

File "[...] anderson_acceleration.py", line 19, in anderson_qr_factorization
  gamma = torch.linalg.lstsq(DR, R[:, -1]).solution
NameError: name 'R' is not defined

For that line, should R be DR instead?

@henrymai
Copy link
Contributor Author

My pull request here (for history offload to cpu memory) includes a fix for this typo: #3

@allaffa
Copy link
Collaborator

allaffa commented Oct 29, 2021

Hi! First of all, thank you very much for contributing :-)

I attach here a screenshot from a presentation that describes how Anderson Acceleration is defined
Screen Shot 2021-10-29 at 10 15 09 AM

What is defined as W in the slide, the code defines as DX
What is defined as R in the slide, the code defines as DR
The coefficient matrix DR is constructed so that every column is the difference between residuals computed at consecutive iterations.

The right-hand-side is the residual at the very last iteration.

So I think that line 19 of anderson_acceleration.py is define correctly

@henrymai
Copy link
Contributor Author

henrymai commented Oct 29, 2021

Hi,

If line 19 is correct, where is R defined? Did you see the error I included in the post?

Never mind, @allaffa answered in my pull request comment. I submitted a new PR to change the right hand side to DX now.

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

No branches or pull requests

2 participants