Repository navigation
Change solver defaults - #941
Open
gertjanvanzwieten wants to merge 10 commits into
Open
gertjanvanzwieten wants to merge 10 commits into
gertjanvanzwieten wants to merge 10 commits into
Conversation
This patch adds a missing droptol in a boundary constraints projection.
This patch removes the base solver logic that skips the actual solve step if the residual norm is already below atol. While technically correct, this behaviour is almost never desired, and may leads to unexpected time series stagnations and other mysterious failures.
This patch moves the stop criterion of the Arnoldi iterative solver to after the first iteration. This is related to commit 94bfe85: formerly the Arnoldi solver would not be invoked if resnorm < atol, but now that it is, we want it to do at least one solve.
gertjanvanzwieten
force-pushed
the
solver-defaults
branch
2 times, most recently
from
November 19, 2026 15:43
b6169f2 to
cd3ffa4
Compare
This patch changes the default solver from "arnoldi" to "direct", which is a more natural default that is faster (doing only one iteration) and should be fine in the majority of situations that the matrix is well conditioned.
gertjanvanzwieten
force-pushed
the
solver-defaults
branch
3 times, most recently
from
November 19, 2026 21:41
926e550 to
7574fd0
Compare
joostvanzwieten
previously approved these changes
Nov 20, 2026
| if rhs.shape[0] != self.shape[0]: | ||
| raise MatrixError('right-hand size shape does not match matrix shape') | ||
| if not self.shape[0]: # 0 x 0 matrix | ||
| return numpy.zeros([0]) |
Member
There was a problem hiding this comment.
For real systems this is fine. If the system is complex, lhs as returned below will always be complex, right? Then maybe we should make the zeros complex as well?
Contributor
Author
There was a problem hiding this comment.
Indeed! Fixed.
This patch cleans up some solver.System code by introducing an __initargs attribute that is referenced from both __reduce__ and __nutils_hash__.
This patch adds an explicit copy in System.construct so that the function can be relied upon to always return a new dictionary.
gertjanvanzwieten
force-pushed
the
solver-defaults
branch
from
November 20, 2026 14:25
7574fd0 to
f8f4973
Compare
This patch cleans up the logic by which solver.System evaluates its jacobians, residuals and values. The caching mechanism is simplified by introducing _cached_eval, and otherwise caching only constant matrices under key "jac".
gertjanvanzwieten
force-pushed
the
solver-defaults
branch
from
November 20, 2026 14:34
f8f4973 to
cd000fb
Compare
This branch has not been deployed
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.
No description provided.