Dimension scaling
State dimension is the second axis (after stiffness) along which
solver choice matters. Per-step cost grows differently for explicit
and implicit schemes, and the crossover where one beats the other
moves with n.
The chart
Section titled “The chart”What it shows
Section titled “What it shows”The benchmark integrates a tridiagonally-coupled linear ODE,
dy_i/dt = -α y_i + β (y_{i-1} + y_{i+1}), α = 2, β = 0.5over t ∈ [0, 5], at n ∈ {2, 10, 50, 200}.
- DoPri5 has slope ≈
1.0on a log-log plot of runtime versusn— each RHS evaluation doesO(n)work, and the number of steps doesn’t depend onnhere, so the total scales linearly. - Radau5 has a steeper slope. Each step solves a dense linear
system inside Newton, which is
O(n³)for an unstructured Jacobian. The full sweepn ∈ {2, 10, 50, 200}runs comfortably inside Criterion’s budget — then = 200Radau5 point lands at ~46 ms, dominated by the dense LU factorisation rather than the step count.
When does this matter?
Section titled “When does this matter?”The two regimes:
- Non-stiff problems with large
n— stay explicit. Even a high-order RK is cheaper than factoring a 200×200 dense matrix every step. - Stiff problems with structured Jacobians — the implicit-solver cost in this chart is worst case (dense Jacobian). For problems where the Jacobian is banded, sparse, or block-structured, the cost-per-step drops dramatically. See the linear algebra chapter for what Numra exposes there.
If you’re unsure: pass Hints::dimension(n) to auto_solve_with_hints
and the heuristic will pick an appropriate scheme.
What’s not in the chart
Section titled “What’s not in the chart”This is a non-stiff problem. For stiff high-dimensional problems,
the calculus shifts — the implicit solver may still win by a wide
margin because its step size doesn’t shrink with stiffness, even if
each step is more expensive. The PDE method-of-lines bench (separate
file bench_pde_mol.rs) explores that regime; see the appendix’s
solver-reference for the underlying tradeoffs.