Skip to main content

hermite_function_n

Function hermite_function_n 

Source
pub fn hermite_function_n<P, E, V, const N: usize, const EXACT_FMA: bool>(
    x: V,
) -> V
where P: Policy, E: FloatElement, V: FloatVector<Element = E> + SpecializedTranscendentalMath<E>,
Expand description

The orthonormal Hermite function $\psi_N(x) = (2^N N! \sqrt{\pi})^{-1/2} e^{-x^2/2} H_N(x)$.

Three-term recurrence on the functions themselves,

psi_{k+1} = sqrt(2/(k+1)) x psi_k - sqrt(k/(k+1)) psi_{k-1}

which keeps every intermediate O(1): the polynomial’s growth and the Gaussian’s decay cancel inside each step instead of being formed separately and multiplied. Both square roots are literals under the unrolled loop, so the per-step cost is one FMA on the critical path plus one multiply beside it. See [seed] for the range and the precision of the Gaussian factor.

Last built: 2026-09-08 21:35:55 UTC