-
Notifications
You must be signed in to change notification settings - Fork 54
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
[Feature Request] Add Option for Initial Solution Vector #414
Comments
If you have a good initial vector, we recommend doing the following:
The reason is that if ||xinit|| is "large", the successive steps generated by CG could be "small" in comparison and, when added to xinit, be absorbed because of numerical effects. That is less likely to happen if you perform the steps above as the final CG solution ∆x will be larger than individual steps. That said, it's true that we could provide this kind of convenience interface. I seem to remember that this has come up before. |
I see the logic. So indeed it will be great to have a wrapper to do just this. Also, I think it will be good to take the suggestion I made about the in place versions. |
Not sure I understand. What's wrong with changing the max number of iterations?
It's already in place. The solution is stored in the solver object and can be reused. |
OK, Let me try explain the current problems I have. I created a solver:
Now, I run it for 100 iterations:
I check the solution and it is not good enough.
Yet it won't work since the solver won't use the last known state. I can do manually what you suggested above, but you understand it is not intuitive for the average user, right? So my 3 suggestions are:
|
I want to use the package
cg()
.Yet it seems it is explicitly set the initial solution vector to zero:
Krylov.jl/src/cg.jl
Line 72 in b3ab247
I think it would be great to have an option (In all solvers) to let the user set the initial condition.
I think you can let the user do it explicitly in the call for
cg()
.It will also play nicely with
cg!()
. Where you should allow set it in the constructor call:CgSolver(n, n, T, xInit)
.Moreover, I think you should set the
cg!()
variant to return nothing.Then the call for
cg()
will be like:Then in
cg!()
it will be shown nothing is returned.The above is probably valid for all functions.
The text was updated successfully, but these errors were encountered: