refactor(solvers): express Fourier/Chebyshev/spherical Helmholtz solvers through `gaussx.DiagonalisedOperator` once it ships
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- jupyter-notebook, python
- Domain
- backend-api-design, tooling
Research direction
This is a design refactor blocked on external library features. Start by reading issue #84 and PR #106 to understand the context. Examine the existing solver implementations in spectraldiffx (likely under a solvers/ directory) and the gaussx library's DiagonalisedOperator and KroneckerSum types. The goal is to replace direct solve calls with gaussx operator constructions, then run the existing solver tests to verify correctness and performance.
Written by the indexing model from the issue text.
Description
Part of #84. Blocked on jejjohnson/gaussx#261 (DiagonalisedOperator), jejjohnson/gaussx#262 (Circulant), jejjohnson/gaussx#263 (non-symmetric Kronecker-sum solve). Do after #106 (N-D kernel) so there is one place to change.
Summary
Every spectraldiffx Helmholtz/Poisson solve is V⁻¹ (Λ − α)⁻¹ V f with:
| Basis | V |
Λ |
gaussx type |
|---|---|---|---|
| Fourier periodic | fftn / ifftn |
fft_eigenvalues (FD2) or −k² (spectral) |
Circulant |
| Fourier Dirichlet/Neumann/mixed, per axis | DST/DCT type 1–4 pair | dst*_eigenvalues, dct*_eigenvalues |
DiagonalisedOperator per axis, combined via KroneckerSum |
| Chebyshev (after #79) | interior eigenvector matrices V, V⁻¹ from eig |
real eigenvalues of D² with boundary rows removed |
non-symmetric KroneckerSum factors |
| Spherical | SHT forward/inverse | −l(l+1)/R² |
DiagonalisedOperator |
Once gaussx has these types, spectraldiffx's solver layer reduces to (a) the BC → (transform pair, eigenvalues) table, (b) modify_rhs_* for inhomogeneous BCs, (c) the null-mode gauge policy. gaussx.solve(A − αI, f) does the rest, and the operators become usable in gaussx.logdet (grid GP priors), gaussx.sqrt (sampling), MaskedOperator (immersed boundaries, jejjohnson/gaussx#265), and as preconditioners (#112).
Measured cost of the abstraction: 0.97x of the direct solve when the inverse is wrapped as a custom lineax.AbstractLinearSolver; 1.8x on implicit-diff gradients. Keep the direct solve_* functions as the hot-loop path and offer the operator view alongside.
Proposed design
HelmholtzSolver.operator(alpha) -> gaussx.DiagonalisedOperator | KroneckerSum(forward operator), andHelmholtzSolver.solveimplemented asgaussx.solve(self.operator(alpha), rhs)behind a feature flag until benchmarks confirm parity, then switched.- Chebyshev:
ChebyshevHelmholtzSolver2Dfrom #79 currently holds its own Haidvogel–Zang diagonalisation; replace with the gaussx non-symmetric Kronecker-sum solve when gaussx#263 lands. - Spherical:
SphericalPoissonSolver/SphericalHelmholtzSolverviaDiagonalisedOperator(forward=grid.transform, inverse=..., eigenvalues=-l(l+1)/R²).
Acceptance criteria
- All existing solver tests pass with the gaussx-backed path enabled (values identical to 1e-12).
- Benchmark in the PR: gaussx-backed vs direct for 2D 128² periodic, 2D 128² Dirichlet, 3D 64³, Chebyshev 2D N=64, spherical T63; each within 1.2x.
-
gaussx.logdet(solver.operator(alpha))matches the sum of log eigenvalues for a small grid. - Docs: a "spectraldiffx as gaussx operators" page.
- Dominant language
- Python
- Stars
- 2
- Forks
- 0
- Avg merge
- 8h 13m
- Merged PRs (30d)
- 8
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jejjohnson/spectraldiffx
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jejjohnson/spectraldiffx#172 ·
-
epic
Difficulty 1/5 Under an hour Newbie friendliness 62/100
jejjohnson/spectraldiffx#167 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
jejjohnson/spectraldiffx#113 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jejjohnson/spectraldiffx#105 ·
-
dependencies
Difficulty 4/5 3-5 days Newbie friendliness 45/100
jejjohnson/spectraldiffx#181 ·
All issues in jejjohnson/spectraldiffx
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day