feat: Harmonic Balance solver, example reorganisation, and HB tests#5
Merged
feat: Harmonic Balance solver, example reorganisation, and HB tests#5
Conversation
Implements setup_harmonic_balance(), a JAX-native periodic steady-state solver that uses vmap over K time points, rfft/irfft for the HB residual, and optx.FixedPointIteration (lax.while_loop) for a JIT-compatible Newton loop — no manual block-circulant Jacobian derivation required. - circulax/solvers/harmonic_balance.py: new solver; returns a plain callable matching the setup_transient API pattern - circulax/solvers/__init__.py, circulax/__init__.py: export setup_harmonic_balance at the top-level package - docs/harmonic_balance.md: full mathematical derivation and usage guide - docs/SUMMARY.md: add nav entry - examples/harmonic_balance.ipynb: LCR resonator (validated against analytical Bode) + diode half-wave clipper + jax.vmap frequency sweep over 5 points in a single XLA compilation - CLAUDE.md: updated simulation flow and key files table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Brings in the Harmonic Balance solver (setup_harmonic_balance), docs, and example notebook from the harmonic_balance feature branch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…analysis type
Groups the 8 example notebooks under examples/electrical/{dc,transient,harmonic_balance}
and examples/photonic/{dc,transient}. Updates pyproject.toml copy-examples task to
reflect the new directory structure.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tor notebook compile_netlist now adds "Instance,state" entries to port_map alongside "Instance,port" entries, giving callers direct index access to component internal states (e.g. port_map["Ring,a"] for ring energy). Previously states had to be reconstructed indirectly from port voltages. - compiler.py: iterate comp_cls.states by name in the index assignment loop; update docstring - test_compiler.py: update assertion to derive num_nets from connection keys only; assert state keys are present in port_map - ring_modulator.ipynb: use port_map["Ring,a"] directly; replace eqx.tree_at sweeps with update_group_params; remove AI-generated comments; add worktree kernel metadata Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds NRZSource (sum-of-sigmoids, JAX-compatible) with 128-bit PRBS pattern. Shows RC-filtered time-domain waveforms and an eye diagram with T_bit/2 fold offset so both crossings are centred, revealing ISI and eye closure not predictable from small-signal frequency response alone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
circulax/solvers/harmonic_balance.py): newsetup_harmonic_balance()for periodic steady-state analysis via Newton–Raphson in the frequency domain, compatible withjax.jit,jax.vmap, andjax.gradexamples/electrical/{dc,transient,harmonic_balance}andexamples/photonic/{dc,transient,advanced}; new ring modulator and HB frequency-sweep notebooks addedtests/test_harmonic_balance.py): 24 tests covering correctness,jax.jit,jax.vmap, andjax.gradfor both real (float64) and complex (photonic) circuits, parametrised over all three solver backendsharmonic_balance.mdpage and updatedindex.md/SUMMARY.md