chore: Refactor linear solver to have pre conditioner baked in the same class - #501
Closed
anushkasinghh wants to merge 18 commits into
Closed
chore: Refactor linear solver to have pre conditioner baked in the same class#501anushkasinghh wants to merge 18 commits into
anushkasinghh wants to merge 18 commits into
Conversation
anushkasinghh
force-pushed
the
anushka/preconditionerRefactoring
branch
from
June 4, 2025 10:44
8e08a8c to
88d02e4
Compare
anushkasinghh
force-pushed
the
anushka/preconditionerRefactoring
branch
from
June 13, 2025 09:07
508bca3 to
ee6ceab
Compare
… on presence of preconditioner. - Clarified separation of `solve_with_pc` and `solve_without_pc`, improving solver flexibility and consistency. - Updated test_solver_tridiagonal to handle uninitialized 'pc' variable: - Avoided UnboundLocalError by checking for 'pc' using 'locals()' before referencing. - Updated test_x0_update
Previously, CG and BiCG defined the `.solve` method dynamically inside `.dot()`, based on whether a preconditioner was provided. This caused errors when `.solve()` was called on transposed solver objects, since `.dot()` had not been invoked yet and `.solve` was not initialized. This commit moves the `.solve` assignment logic into the constructor (`__init__`), ensuring `.solve` is always available and correctly bound, even for transposed instances. This makes CG/BiCG consistent with other solver classes where `.solve()` is always defined.
Contributor
Author
|
While debugging the It looks like the preconditioner is destabilizing the method for complex matrices. Would you recommend skipping the preconditioner in this specific case @yguclu ? |
added 3 commits
July 4, 2025 15:14
…s to divergence of solution for complex systems in test_solver_tridiagonal
…Gleichungssysteme". Set pc = None for bicgstab with pc, as solution doesnt converge otherwise.
anushkasinghh
pushed a commit
that referenced
this pull request
Jul 19, 2025
Contributor
Author
|
changes migrated to pr512 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor linear solver to have pre conditioner baked in the same class. Pre conditioner is now a parameter rather than a different class altogether.
The following is done in the pull request more granularly :
Will solve #469 when merged