Epic: gaussx integration (consume structured operators, expose spectral preconditioners, fix the dependency pin)

Open
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
jupyter-notebook, python

Research direction

This is an epic coordinating multiple issues across two repositories. Start by reading the linked child issues (#112, #113, #114, #115) and the gaussx-side issues. The first actionable piece is likely #112, which involves wrapping spectral solvers as lineax operators. Examine the existing solve_helmholtz_fft function and the lineax integration points. The goal is to enable spectral preconditioners within the gaussx structured linear algebra framework.

Written by the indexing model from the issue text.

Description

enhancement epic

Scope

The spectraldiffx side of a two-repo effort; the gaussx side is jejjohnson/gaussx#258, and finitevolX consumes both (jejjohnson/finitevolX#279). Every solver in spectraldiffx is an operator whose eigenbasis is a fast transform (operator = V⁻¹ Λ V with V an FFT/DCT/DST/Legendre pair). gaussx has the generic structured-linear-algebra machinery (KroneckerSum, MaskedOperator, CapacitanceSolver, Toeplitz, preconditioned CG, logdet/sqrt dispatch) but no "fast-diagonalisable operator" type, so today the only shared piece is the capacitance solver.

Benchmarks from the audit (128² Helmholtz, x64, CPU) that decide the direction:

Variant ms/solve
direct solve_helmholtz_fft 0.40–0.65
gaussx.solve(KroneckerSum − λI) today (dense eigh per solve) 3.4–295
spectral inverse wrapped as a custom lineax.AbstractLinearSolver 0.485 (0.97x, no overhead)
lineax.CG on the FD stencil 56–72 (115–144x slower)
variable-coefficient ∇·(a∇ψ) − λψ: plain CG 549 iterations, 144 ms
same with the spectral solve as preconditioner via gaussx.linear_solve(..., preconditioner=OperatorPreconditioner(M)) 16 iterations, 12–14 ms (works with gaussx v0.0.17 today)

Conclusion: wrapping spectral solvers as lineax/gaussx operators costs nothing on solves (1.8x on implicit-diff gradients, so keep direct functions for hot loops) and buys composability. Quadrature rules and Kronecker-of-transforms should stay in spectraldiffx (dctn(axes=...) already is the fused Kronecker transform).

gaussx-side work (jejjohnson/gaussx#258)

  • jejjohnson/gaussx#259 CapacitanceSolver storage layout / memory / static base_solve
  • jejjohnson/gaussx#260 CapacitanceSolver constant-augmented system for singular bases
  • jejjohnson/gaussx#261 DiagonalisedOperator
  • jejjohnson/gaussx#262 Circulant
  • jejjohnson/gaussx#263 non-symmetric Kronecker-sum solve
  • jejjohnson/gaussx#265 solve(MaskedOperator) dispatch
  • jejjohnson/gaussx#266 publish gaussx to PyPI

spectraldiffx-side child issues (in suggested order)

  • #112 feat(solvers): as_lineax_operator / as_preconditioner + variable-coefficient CG docs example — works today, highest value per effort
  • #113 build: bump gaussx pin to v0.0.28 now; drop the git pin once gaussx is on PyPI
  • #114 refactor(solvers): express Fourier/Chebyshev/spherical solvers through gaussx.DiagonalisedOperator (blocked on gaussx#261/#262/#263; after #106)
  • #115 refactor(capacitance): replace the wrapper with gaussx.solve(MaskedOperator(...)) (blocked on gaussx#265, #259, #260; the correctness fix is #87 and does not wait)
  • #123 refactor(capacitance): rename spectraldiffx.CapacitanceSolver to avoid the clash with gaussx.CapacitanceSolver — requested by finitevolX (jejjohnson/finitevolX#318)

Related

  • #80 (correctness), #81 (spherical), #82 (JAX-native; #102 is a prerequisite here), #83 (Fourier consolidation), #85 (hygiene).
  • Downstream: jejjohnson/finitevolX#279 (its dependency epic), #315–#319.
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jejjohnson/spectraldiffx

All issues in jejjohnson/spectraldiffx

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.