fix(fourier): no Python control flow on traced Fourier parameters

Aperta
#149 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@jejjohnson ci sta già lavorando.

Dal 17/10/2026.

  • #157 di @jejjohnson — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Read fourier/operators.py, fourier/eigenvalues.py, fourier/grid.py, and fourier/solvers.py at the listed validation and shortcut sites, then inspect pull request #157, which is already open against this issue. The work spans traced-value handling across Fourier operators, eigenvalues, grids, and solvers. Done means the listed JIT, vmap, grad, and spectral solve cases work, with concrete invalid values raising ValueError and traced invalid values raising at runtime.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug source

Part of epic #148. The Fourier-family part of #103. No dependencies.

Problem

Learnable coefficients and parameter sweeps cannot get through these checks:

jax.jit(lambda nu: d.hyperviscosity(u, nu, 2))(1e-3)   # TracerBoolConversionError
site check
fourier/operators.py::_validate_hyperviscosity (1-D / 2-D / 3-D hyperviscosity) if nu < 0, if order < 1
fourier/eigenvalues.py::_validate_L (every *_eigenvalues_ps, so every approximation="spectral" solve with traced dx) if L <= 0
fourier/grid.py check_consistency / from_L_dx if jnp.isclose(...)
fourier/solvers.py::modify_rhs_1d if left_val == 0.0 and right_val == 0.0

Proposal

As #103 proposes:

  • Numeric ranges. Use eqx.error_if(x, nu < 0, …) on a traced value, and keep the ValueError for a concrete one. order is an exponent, so it stays a validated Python int.
  • Grid checks. Use math.isclose on Python floats, and skip the check for tracers.
  • modify_rhs_1d. Skip the shortcut when the values are traced.

Spherical and Chebyshev sites stay with #103.

Acceptance criteria

  • jit / vmap / grad over nu for hyperviscosity (1-D, 2-D, 3-D) equal eager to 1e-12.
  • jax.jit(solve_helmholtz_dst, static_argnames="approximation") with traced dx and approximation="spectral" works.
  • Concrete invalid values still raise ValueError; traced invalid values raise at run time.

Generated by Claude Code

Lingua principale
Python
Stelle
2
Fork
0
Merge medio
8h 13m
PR unite (30g)
8

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jejjohnson/spectraldiffx

Tutte le issue di jejjohnson/spectraldiffx

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.