Fix fd gather priority - #3016
Open
mloubout wants to merge 2 commits into
Open
Conversation
`highest_priority` ranked operands by `_fd_priority`, which an `Add` or `Mul` reports as the generic `Differentiable` fallback rather than as the priority of the Functions it is built from. Operands carrying quite different staggering therefore tied there, and `sorted` being stable the winner fell out of SymPy's argument ordering -- which differs between an `EvalDerivative` and the `IndexDerivative` standing for the same expression, so `expand` silently decided where a product was gathered. On an elastic TTI gradient that put the `I * C * I^T` contraction on the strain instead of on the node-centred stiffness, leaving an outer interpolation that the NODE block would not have needed. With `expand=False` the second-order error then fell with slope 1.46 rather than 2, and scaling a kernel by two changed the result by 1.27 rather than by 2.
Fails without the fix: `highest_priority` comes back with the staggered Function, the two sums both reporting the `Differentiable` fallback (.5) rather than the NODE Function's 1.2, and so tying.
mloubout
force-pushed
the
fix-fd-gather-priority
branch
from
September 4, 2026 14:58
f953801 to
07a38b0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3016 +/- ##
=======================================
Coverage 83.72% 83.72%
=======================================
Files 257 257
Lines 54822 54838 +16
Branches 4693 4694 +1
=======================================
+ Hits 45901 45915 +14
- Misses 8110 8111 +1
- Partials 811 812 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.