Repository navigation
Implement kernel rewriting - #279
Conversation
c2abca1 to
a9f5083
Compare
8e21ddf to
6065fb6
Compare
167e884 to
db038c5
Compare
db038c5 to
8e1e6fe
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved fallback failures, rejected constant-only rewrites, and parameter-symbol mismatches break supported behavior and existing tests.
5 open findings
What changed in this PR
Adds kernel rewriting to express target kernels as constant-coefficient combinations of base-kernel derivatives.
Changes:
- Implements symbolic Fourier and numerical LU rewriting.
- Standardizes spatial-constant parameters in kernel PDEs.
- Adds rewrite tests and documentation.
| File | Description |
|---|---|
| sumpy/tools.py | Adds multi-index differentiation. |
| sumpy/test/test_misc.py | Updates PDE tests for spatial constants. |
| sumpy/test/test_kernel_rewrite.py | Adds rewriting and conditioning tests. |
| sumpy/kernel.py | Updates PDE parameters and marks unsupported system PDEs. |
| sumpy/kernel_rewrite.py | Implements rewrite representations and algorithms. |
| doc/kernel.rst | Includes kernel rewriting documentation. |
| .basedpyright/baseline.json | Updates type-checking diagnostics. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| target_system_kernel, idx = None, None | ||
|
|
||
| if target_system_kernel is None: | ||
| pde_target = target_kernel.get_pde_as_diff_op() |
There was a problem hiding this comment.
Not sure we want to support that.
8e1e6fe to
0f32c9c
Compare
|
|
||
|
|
||
| def rewrite_using_base_kernel( | ||
| target_kernel: ScalarKernel, |
7228321 to
82ef0cd
Compare
82ef0cd to
d617de5
Compare
d617de5 to
3426042
Compare
|
The Symengine CI seems to die here. The only "obvious" thing in the log is a zillion warnings about |
It's still dying in the distributed tests (two of them) with the same so I'm guessing whatever was happening in the
Yeah, that fix is in EDIT: I told |
3426042 to
949f3fb
Compare
|
@inducer A wholesome re-run seems to have "fixed" the problem.. 🤷 |


This implements rewriting a target kernel (e.g. Stokeslet) in terms of a base kernel (e.g. biharmonic) as a linear constant-coefficient combination of derivatives.
Currently, it just hoists
get_deriv_relation_kernelfrom inducer/pytential#162 with some minimal changes:TODO:
pytential).Implement a hopefully better (but likely slower?) purely-symbolic version.Needs
cc @isuruf