pub fn legendre_series_slice<E, V>(x: V, coeffs: &[E]) -> Vwhere
E: FloatElement,
V: FloatVector<Element = E>,Expand description
Runtime-length form of legendre_series.
A genuine port of the recurrence rather than a fold over the const kernel: a series
carries k-dependent state and does not partition the way the slice reductions in
thermite do. Both forms must be edited together.
chebyshev_series no longer has a twin like this, its two bodies having been merged
behind an N = 0 sentinel and an assert_unchecked. This one has not been merged,
and the reason is a and b_next below. They are E::from_ratio calls, not
const fns, so they become literals only when LLVM fully unrolls the loop. Chebyshev’s
only per-step quantity is coeffs[k] and has nothing to lose, while merging here would
put a division per step behind an assume that nothing would detect. Wants an asm or
llvm-mca check before anyone tries it.
What the runtime length costs here is more than the lost unrolling: a_k and b_{k+1}
are no longer compile-time constants, so each step pays a division to form them. If the
degree is known, legendre_series is meaningfully cheaper, not just tidier.
The empty series is 0, where the const form refuses to compile.