Part II · SSM Core Week 10 Published

Mamba-3 and the exponential-trapezoidal integrator

How Mamba-3 keeps selectivity and changes two things — a second-order exponential-trapezoidal integrator and a complex state — turning the dynamical-systems lens of Chapters 4-6 onto a production sequence model.

On this page
  1. 10.1 Two upgrades to the selective SSM
  2. 10.2 The exponential-trapezoidal scheme
  3. 10.3 Stability and accuracy decouple
  4. 10.4 Complex state: decay and oscillation in one head
  5. 10.5 The trapezoidal SSD pass
  6. 10.6 MIMO and the production block
  7. 10.7 What’s next
  8. 10.8 Exercises
  9. Exercise 10.1 (short)
  10. Exercise 10.2 (short, code)
  11. Exercise 10.3 (short)
  12. Exercise 10.4 (theory) — solution in §10.9
  13. Exercise 10.5 (theory) — solution in §10.9
  14. Exercise 10.6 (theory) — solution in §10.9
  15. 10.9 Full solutions to theory exercises
  16. Solution to Exercise 10.4
  17. Solution to Exercise 10.5
  18. Solution to Exercise 10.6
  19. 10.10 Companion code

Mamba-3 and the exponential-trapezoidal integrator

10.1 Two upgrades to the selective SSM

Chapter 9 built the selective SSM: input-dependent (Δt,Bt,Ct)(\stepsize_t, \inputmat_t, \outputmat_t) make the dynamics linear time-varying, the convolution view collapses, and the selective scan plus the semiseparable-matrix view (SSD) carry the computation. Mamba-1 and Mamba-2 both discretize with zero-order hold (ZOH) and keep a real diagonal state matrix A\statemat.

Mamba-3 Lahoti et al. (2026) changes two things of dynamical-systems substance and leaves the rest of the SSD scaffold (the semiseparable structure of Theorem 9.4, the scan, the attention duality of Theorem 9.5) intact:

  1. A second-order integrator. ZOH is first-order accurate; Mamba-3 adopts a second-order exponential-trapezoidal scheme — the exponential-integrator idea of Chapter 4 §4.5 in its trapezoidal-quadrature form (§10.2) — while keeping ZOH’s exact treatment of the homogeneous dynamics (§10.2-10.3).
  2. A complex state. A real diagonal mode A<0\statemat < 0 can only decay; a complex mode A=logρ+iθ\statemat = \log\rho + i\theta decays and rotates, so a single head becomes a damped oscillator (§10.4).

Both changes are dynamical-systems moves, and both have been waiting since the foundations chapters: the integrator is the Chapter 4-5 story applied to a real architecture, and the complex state is the spiral phase portrait of Chapters 1-2. The C1 pilot’s empirical question — whether a second-order, structure-preserving integrator actually buys accuracy on a selective SSM without costing stability — is the through-line.

10.2 The exponential-trapezoidal scheme

Recall the continuous mode h˙=Ah+u(t)\dot{\statevec} = \statemat \statevec + u(t), whose exact one-step map is hk=eAΔhk1+0ΔeA(Δs)u(tk1+s)ds\statevec_k = e^{\statemat\stepsize}\statevec_{k-1} + \int_0^{\stepsize} e^{\statemat(\stepsize - s)}\, u(t_{k-1}+s)\,ds. Every exponential integrator keeps the transition eAΔe^{\statemat\stepsize} exact (the philosophy of Chapter 4 §4.5) and approximates only the forcing integral. ZOH holds the input constant at the left endpoint; the exponential-trapezoidal scheme applies the trapezoidal quadrature rule to the forcing integral — averaging the integrand at the two endpoints. The integrand is eAΔuk1e^{\statemat\stepsize} u_{k-1} at s=0s = 0 and uku_k at s=Δs = \stepsize, so the rule gives Δ2(eAΔuk1+uk)\tfrac{\stepsize}{2}(e^{\statemat\stepsize} u_{k-1} + u_k). Weighting the two endpoints by λ[0,1]\lambda \in [0,1] gives the three-term update

hk=αhk1+βuk1+γuk,α=eAΔ,  β=(1λ)Δα,  γ=λΔ.\statevec_k = \alpha\, \statevec_{k-1} + \beta\, u_{k-1} + \gamma\, u_k, \qquad \alpha = e^{\statemat \stepsize},\; \beta = (1-\lambda)\,\stepsize\,\alpha,\; \gamma = \lambda\,\stepsize .

The contrast with ZOH is the third term: where ZOH reads only the left endpoint uk1u_{k-1}, the trapezoid reads both endpoints. At λ=12\lambda = \tfrac12 this is the symmetric trapezoidal rule (globally second-order); at λ=1\lambda = 1 it collapses to a shifted ZOH (first order). Mamba-3 makes λ\lambda itself input-dependent (a sigmoid of a learned projection), one more selective knob.

This single fact — that α\alpha is identical for the two schemes — has a sharp consequence for how the order can be measured.

Theorem 10.1 (Second order lives in the forcing, and is invisible without it).

For λ=12\lambda = \tfrac12 the exponential-trapezoidal scheme has local truncation error O(Δ3)O(\stepsize^3) per step, hence global order 2, provided the input uu is non-constant and C2C^2. On the homogeneous system (u0u \equiv 0) both ZOH and exp-trapezoidal reproduce the exact solution hk=eAtkh0\statevec_k = e^{\statemat t_k} \statevec_0 to machine precision, so the order difference is unobservable there.

The proof is Exercise 10.4 (§10.9). The practical reading is a trap worth naming: because the homogeneous transition is exact, a convergence study run on an autonomous system shows ZOH and exp-trapezoidal as identical lines at roundoff — the second order is simply not visible. The companion confirms this directly: on the autonomous mode both schemes sit at 2×1015\sim 2 \times 10^{-15}, while on the forced mode the fitted convergence slopes separate cleanly into 1.001.00 (ZOH) and 2.002.00 (exp-trapezoidal). This is the same lesson Chapter 4 flagged in Exercise 4.3 (“setting u0u \equiv 0 makes ZOH exact; the slope is meaningless”), now load-bearing for verifying a real architecture’s headline claim.

Log-log plot of maximum error versus step size on a forced complex mode, ZOH at slope 1 and exponential-trapezoidal at slope 2.
Global error versus step size on the forced mode $\dot{x} = A x + \sin(\omega t)$ with $A = -0.5 + 2i$. ZOH (navy) fits slope 1.00; exponential-trapezoidal (rose) fits slope 2.00; dotted guides mark the reference slopes. The order separation appears only because the input is non-constant — on the homogeneous system both lines collapse to roundoff. Produced by companions/ch10/jax/discretization.py; the slopes are pinned in tests/test_discretization.py.

10.3 Stability and accuracy decouple

Why adopt an exponential integrator rather than a higher-order Runge-Kutta method? Because the exponential transition is exact, the discrete amplification factor is α=eRe(A)Δ|\alpha| = e^{\operatorname{Re}(\statemat)\stepsize}, which is <1< 1 for any stable mode (Re(A)<0\operatorname{Re}(\statemat) < 0) at any step size. ZOH and exp-trapezoidal are therefore unconditionally stable on the homogeneous part — A-stable over the entire left half-plane — and, crucially, stability is set by A\statemat alone, independent of the order of the forcing quadrature. For a Runge-Kutta method a single stability polynomial controls both accuracy and the stability region; the exponential integrator decouples them.

Theorem 10.2 (Exponential schemes are A-stable and damp stiff modes).

For Re(A)<0\operatorname{Re}(\statemat) < 0, the exponential-trapezoidal (and ZOH) amplification factor satisfies α=eRe(A)Δ<1|\alpha| = e^{\operatorname{Re}(\statemat) \stepsize} < 1 for every Δ>0\stepsize > 0, and α0|\alpha| \to 0 as the mode stiffens (Re(A)Δ\operatorname{Re}(\statemat)\stepsize \to -\infty). The bilinear (Tustin) scheme is also A-stable but uses the (1,1)(1,1)-Padé approximation α=(1+AΔ/2)/(1AΔ/2)\alpha = (1 + \statemat\stepsize/2)/(1 - \statemat\stepsize/2), for which α1|\alpha| \to 1 as the mode stiffens: stiff modes are left undamped.

The proof is Exercise 10.6 (§10.9). The companion makes the contrast quantitative: at a stiff AΔ=30\statemat\stepsize = -30, the exponential schemes give α9.4×1014|\alpha| \approx 9.4 \times 10^{-14} (fully damped) while bilinear gives α=0.875|\alpha| = 0.875 (still ringing). This is why an exponential integrator is the right tool when the input-dependent A(ut)\statemat(u_t) of a selective SSM produces stiff dynamics, as Chapter 4 §4.5 anticipated for exactly this chapter. One caveat matters for §10.4: the theorem bounds the magnitude α|\alpha| only. For a complex mode it says nothing about how faithfully the discrete rotation tracks the continuous phase θΔ\theta\stepsize — phase fidelity is a separate question, and the open one the frontier paragraph below raises.

Two panels: left, A-stability regions in the complex plane; right, amplification magnitude versus stiffness for exponential versus bilinear schemes.
Left: the exponential schemes are A-stable on the whole left half-plane ($\operatorname{Re}(A\Delta) \le 0$), whereas forward Euler is stable only inside its unit disk. Right: along the negative real axis the exponential amplification $e^z$ decays to zero (stiff modes damped, navy) while the bilinear Padé factor tends to one (stiff modes undamped, rose). Produced by companions/ch10/jax/discretization.py; the stiff-mode contrast is pinned in tests/test_discretization.py.

The geometric-integrator frontier (where the pilot goes next). Exp-trapezoidal is a second-order exponential integrator; it is not symplectic. For the oscillatory complex modes introduced in §10.4, the question the symplectic-integrator pilot asks is whether a geometric integrator (Chapter 6) — one that preserves a phase-space invariant rather than merely a damping bound — controls long-horizon phase error better than exp-trapezoidal does. That is an open empirical question, not a settled result, and it is the heart of the “discretization stability atlas” the pilot pursues; Chapter 17 returns to it. This chapter establishes the settled part: exp-trapezoidal is second-order, A-stable, and exact on the homogeneous part.

10.4 Complex state: decay and oscillation in one head

A real diagonal mode A<0\statemat < 0 gives α=eAΔ(0,1)\alpha = e^{\statemat\stepsize} \in (0,1): pure geometric decay, a single forgetting timescale. Mamba-3 lets the mode be complex, A=logρ+iθ\statemat = \log\rho + i\theta, so

α=eAΔ=ρΔdecay  eiθΔrotation.\alpha = e^{\statemat\stepsize} = \underbrace{\rho^{\stepsize}}_{\text{decay}}\; \underbrace{e^{i\theta\stepsize}}_{\text{rotation}} .

The magnitude decays at rate logρ\log\rho per unit step and the phase advances by θΔ\theta\stepsize: a single head is now a damped oscillator, tracing the logarithmic spiral of Chapters 1-2 rather than a monotone decay. This lets one head represent an oscillatory feature — a frequency — instead of only a timescale.

In production Mamba-3 never stores a complex dtype. It keeps a real state and applies rotary position embeddings (RoPE) — 2-D rotations — to the projections B,C\inputmat, \outputmat. The justification is the elementary isomorphism between complex multiplication and 2×22\times 2 rotation-scaling.

Theorem 10.3 (RoPE rotation equals complex multiplication).

Representing z=a+biz = a + bi as the real vector [a,b][a, b]^\top, multiplication by ρeiθ\rho e^{i\theta} equals applying the scaled rotation ρR(θ)=ρ(cosθsinθsinθcosθ)\rho R(\theta) = \rho\left(\begin{smallmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{smallmatrix}\right). Consequently the complex recurrence xk=(ρeiθ)xk1+bkx_k = (\rho e^{i\theta}) x_{k-1} + b_k and the real 2-D recurrence sk=ρR(θ)sk1+[Rebk,Imbk]s_k = \rho R(\theta) s_{k-1} + [\operatorname{Re} b_k, \operatorname{Im} b_k]^\top produce identical trajectories.

The proof is Exercise 10.5 (§10.9). The companion pins the two recurrences equal to 3×1015\sim 3 \times 10^{-15} under a random complex drive, and confirms the spiral’s decay rate equals logρ\log\rho exactly — the empirical content of “decay and oscillation in one head.”

Left, the spiral trajectory of a complex mode in the real-imaginary plane; right, its magnitude decaying geometrically on a log scale.
A single complex mode $\rho = 0.95$, $\theta = 20^\circ$ per step. Left: the state spirals inward in the $(\operatorname{Re}, \operatorname{Im})$ plane — simultaneous decay and rotation. Right: the magnitude follows the $\rho^k$ envelope exactly (measured per-step decay rate $-0.0513 = \log\rho$). Produced by companions/ch10/jax/complex_state.py; the decay rate and RoPE equivalence are pinned in tests/test_complex_state.py.

10.5 The trapezoidal SSD pass

The second-order stencil must coexist with the SSD machinery of Chapter 9 — the semiseparable matrix that lets the layer run as a parallel matmul or a linear-time scan. It does, because only the injection stencil changes. Unrolling the trapezoidal recurrence with the state-transition operator Φ(k,j)=i=j+1kαi=exp(Ai=j+1kΔi)\Phi(k,j) = \prod_{i=j+1}^{k} \alpha_i = \exp(\statemat \sum_{i=j+1}^{k}\stepsize_i) (the same Φ\Phi as Definition 9.2) splits the output into two semiseparable streams that share the one decay Φ\Phi: a right-endpoint stream weighting source jj by λΔj\lambda\stepsize_j, and a left-endpoint stream weighting source jj by (1λ)Δj+1(1-\lambda)\stepsize_{j+1} across the strictly-lower triangle. Both reuse the Chapter 9 segment-sum decay; the order-2 upgrade is two cheap masked matmuls in place of one.

The companion verifies that the dense two-stream matmul reproduces the sequential trapezoidal recurrence to 2×1014\sim 2 \times 10^{-14} (for both real and complex modes), and that the end-to-end output is genuinely second-order — halving the step size cuts the error by a factor of four. The SSD duality of §9.5 survives the integrator upgrade intact: same matrix, two schedules, now order 2.

10.6 MIMO and the production block

Two further Mamba-3 changes sit outside the integrator-and-state story this chapter develops, and we treat them briefly. MIMO rank-RR state mixing (the input and output projections each gain a rank-RR dimension) raises decode-time arithmetic intensity at fixed state size and, Mamba-3 reports, also lifts model quality through the added expressivity (a 1.2\sim 1.2-point average downstream gain over the SISO variant) — but neither effect changes the discretization or stability story. The full production block — SwiGLU gating, QK-normalization, the BC\inputmat\outputmat bias — wraps the layer studied here; those too are orthogonal to the integrator-and-state question, and we point to the reference implementation rather than reproduce them Lahoti et al. (2026) .

What this chapter isolates is the dynamical-systems substance: a selective SSM (Chapter 9) run with a second-order exponential integrator (Chapters 4-5) and a complex state (Chapters 1-2, 8). The open program — whether geometric integrators (Chapter 6) preserve long-horizon phase structure better than the exponential scheme over the learned eigenvalue spectrum — is the discretization stability atlas the C1 pilot builds, and Chapter 17 returns to it.

10.7 What’s next

Mamba-3 kept Chapter 9’s selectivity and changed two things: a second-order exponential-trapezoidal integrator (accuracy in the forcing, stability from the exact exponential) and a complex state (decay and oscillation in one head), realized via RoPE and computed through the trapezoidal SSD pass. This closes the core SSM line — HiPPO (Chapter 7) to LTI S4/S4D/S5 (Chapter 8) to selective Mamba (Chapter 9) to Mamba-3 (here).

Chapter 11 opens the “beyond SSM” part by taking the SSD duality of §9.6 the other way: linear attention and the Hyena long-convolution lineage enter from the attention side of Theorem 9.5, where the structured contractions of these four chapters reappear wearing transformer clothing.

10.8 Exercises

Six problems: three short (inline solutions), three longer (full solutions in §10.9).

Exercise 10.1 (short)

For a complex mode A=logρ+iθ\statemat = \log\rho + i\theta with ρ=0.9\rho = 0.9, θ=π/6\theta = \pi/6, and step Δ=1\stepsize = 1, compute α|\alpha| and the phase advance of α=eAΔ\alpha = e^{\statemat\stepsize} over two steps. Which is the decay timescale and which is the oscillation frequency?

Solution

α=ρeiθ=0.9eiπ/6\alpha = \rho\, e^{i\theta} = 0.9\, e^{i\pi/6}, so α=0.9|\alpha| = 0.9 per step and the phase advances θ=π/6=30\theta = \pi/6 = 30^\circ per step. Over two steps α2=0.81|\alpha^2| = 0.81 and the phase advances 6060^\circ. The magnitude ρ=0.9\rho = 0.9 sets the decay timescale; θ=π/6\theta = \pi/6 sets the oscillation frequency. They are independent — that is the point of a complex mode.

Exercise 10.2 (short, code)

Run companions/ch10/jax/discretization.py. Confirm the fitted convergence slopes are 1\approx 1 for ZOH and 2\approx 2 for exp-trapezoidal on the forced system. Then explain, in one sentence, why the same script reports both schemes at 1015\sim 10^{-15} on the homogeneous system.

Solution

The script prints ZOH slope 1.001.00 and exp-trapezoidal slope 2.002.00 on the forced mode. On the homogeneous mode the transition α=eAΔ\alpha = e^{\statemat\stepsize} is exact for both schemes, so both reproduce h0eAtk\statevec_0 e^{\statemat t_k} to floating-point roundoff and the order difference — which lives entirely in the forcing coefficients β,γ\beta, \gamma — never enters (Theorem 10.1).

Exercise 10.3 (short)

Write the exp-trapezoidal coefficients (α,β,γ)(\alpha, \beta, \gamma) for λ=0\lambda = 0, λ=12\lambda = \tfrac12, and λ=1\lambda = 1. Show that λ=1\lambda = 1 reduces to a first-order shifted ZOH (no current-input term carrying the decay).

Solution

α=eAΔ\alpha = e^{\statemat\stepsize} throughout. λ=0\lambda = 0: β=Δα\beta = \stepsize\,\alpha, γ=0\gamma = 0 (pure left endpoint). λ=12\lambda = \tfrac12: β=Δ2α\beta = \tfrac{\stepsize}{2}\alpha, γ=Δ2\gamma = \tfrac{\stepsize}{2} (symmetric). λ=1\lambda = 1: β=0\beta = 0, γ=Δ\gamma = \stepsize — only the current input uku_k enters, with no decay applied to it, which is a first-order ZOH shifted by one step. The symmetric λ=12\lambda = \tfrac12 is the only second-order member.

Exercise 10.4 (theory) — solution in §10.9

Prove Theorem 10.1: for λ=12\lambda = \tfrac12 the exponential-trapezoidal scheme has local truncation error O(Δ3)O(\stepsize^3) on a forced system, and show that on the homogeneous system both ZOH and exp-trapezoidal are exact.

Exercise 10.5 (theory) — solution in §10.9

Prove Theorem 10.3: that a 2-D rotation by θ\theta on [Rez,Imz][\operatorname{Re} z, \operatorname{Im} z] equals multiplication of zz by eiθe^{i\theta}, and conclude the complex and real-RoPE recurrences coincide.

Exercise 10.6 (theory) — solution in §10.9

Prove Theorem 10.2: that the exponential schemes are A-stable with α0|\alpha| \to 0 on stiff modes, and contrast the bilinear Padé factor, showing α1|\alpha| \to 1 as AΔ\statemat\stepsize \to -\infty.

10.9 Full solutions to theory exercises

Solution to Exercise 10.4

Write the exact one-step map by variation of constants over [tk1,tk][t_{k-1}, t_k]:

h(tk)=eAΔh(tk1)+0ΔeA(Δs)u(tk1+s)ds.\statevec(t_k) = e^{\statemat\stepsize}\statevec(t_{k-1}) + \int_0^{\stepsize} e^{\statemat(\stepsize - s)}\, u(t_{k-1}+s)\,ds .

The transition eAΔe^{\statemat\stepsize} is reproduced exactly by both schemes, so all error is in the forcing integral. Exp-trapezoidal approximates 0Δg(s)ds\int_0^{\stepsize} g(s)\,ds, with integrand g(s)=eA(Δs)u(tk1+s)g(s) = e^{\statemat(\stepsize-s)}\,u(t_{k-1}+s), by the trapezoidal quadrature rule Δ2(g(0)+g(Δ))\tfrac{\stepsize}{2}\big(g(0) + g(\stepsize)\big) — the λ=12\lambda = \tfrac12 endpoint weights of §10.2. The trapezoidal rule on an interval of width Δ\stepsize has error Δ312g(ξ)-\tfrac{\stepsize^3}{12}\,g''(\xi) for some interior ξ\xi; since gg is C2C^2 whenever uu is C2C^2, the local truncation error is O(Δ3)O(\stepsize^3) per step, and summing O(Δ1)O(\stepsize^{-1}) steps over a fixed horizon yields global order 2. For the homogeneous system u0u \equiv 0 the forcing integral vanishes identically and hk=eAtkh0\statevec_k = e^{\statemat t_k}\statevec_0 exactly for both schemes, regardless of order — there is no forcing term to approximate, so the order distinction disappears. \blacksquare

Solution to Exercise 10.5

Let z=a+biz = a + bi and write [z]=[a,b][z] = [a, b]^\top. Then

eiθz=(cosθ+isinθ)(a+bi)=(acosθbsinθ)+i(asinθ+bcosθ),e^{i\theta} z = (\cos\theta + i\sin\theta)(a + bi) = (a\cos\theta - b\sin\theta) + i(a\sin\theta + b\cos\theta),

whose real-vector form is [acosθbsinθ,  asinθ+bcosθ]=R(θ)[z][a\cos\theta - b\sin\theta,\; a\sin\theta + b\cos\theta]^\top = R(\theta)[z] with R(θ)=(cosθsinθsinθcosθ)R(\theta) = \left(\begin{smallmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{smallmatrix}\right). Scaling by ρ\rho commutes with the real isomorphism, so multiplication by ρeiθ\rho e^{i\theta} is ρR(θ)\rho R(\theta) on [z][z]. Applying this at every step of the affine recurrence (the additive drive bkb_k maps to [bk][b_k] componentwise, which the isomorphism also preserves) shows the complex recurrence xk=(ρeiθ)xk1+bkx_k = (\rho e^{i\theta})x_{k-1} + b_k and the real recurrence sk=ρR(θ)sk1+[bk]s_k = \rho R(\theta) s_{k-1} + [b_k] produce identical trajectories under [][\cdot]. \blacksquare

Solution to Exercise 10.6

For the exponential schemes α=eAΔ\alpha = e^{\statemat\stepsize}, so α=eRe(A)Δ|\alpha| = e^{\operatorname{Re}(\statemat)\stepsize}. If Re(A)<0\operatorname{Re}(\statemat) < 0 and Δ>0\stepsize > 0 then the exponent is negative and α<1|\alpha| < 1 for every Δ\stepsize (A-stability over the whole left half-plane), and as the mode stiffens (Re(A)Δ\operatorname{Re}(\statemat)\stepsize \to -\infty) we have α0|\alpha| \to 0. For the bilinear scheme α=(1+z/2)/(1z/2)\alpha = (1 + z/2)/(1 - z/2) with z=AΔz = \statemat\stepsize; writing z=x+iyz = x + iy with x<0x < 0, 1+z/2<1z/2|1 + z/2| < |1 - z/2| (the left point is closer to 2-2, the right to +2+2), so α<1|\alpha| < 1 — also A-stable. But as xx \to -\infty the ratio (1+z/2)/(1z/2)1(1 + z/2)/(1 - z/2) \to -1, so α1|\alpha| \to 1: stiff modes are mapped to the unit circle and ring rather than decaying. This is the qualitative gap the exponential transition closes. \blacksquare

10.10 Companion code

The companions live in companions/ch10/{jax,julia,torch}/. The JAX module covers the integrator, the complex state, and the trapezoidal SSD pass; the PyTorch module mirrors the integrator and complex state (cross-framework parity); the Julia module is the discretization atlas only — the numerical-analysis core — and joins the Chapter 4-6 Julia family that the C1 pilot’s stability atlas builds on.

The discretization study (order slopes, homogeneous-blindness, stability regions):

PYTHONPATH=. python companions/ch10/jax/discretization.py
julia --project=companions/ch10/julia companions/ch10/julia/discretization.jl

The complex state and RoPE equivalence (the spiral figure):

PYTHONPATH=. python companions/ch10/jax/complex_state.py

The trapezoidal SSD pass (matmul equals the sequential oracle):

PYTHONPATH=. python companions/ch10/jax/trapezoidal_ssd.py

The PyTorch mirror (integrator and complex state, parity-checked against JAX):

PYTHONPATH=. python companions/ch10/torch/discretization.py
PYTHONPATH=. python companions/ch10/torch/complex_state.py

Run the suites — JAX and Julia in the fast loop, torch separately:

make companion-jax-tests
make companion-julia-tests
make companion-torch-tests