Expand description
Compiled numeric closures (CompiledFn, CompiledFnVec).
Compile symbolic expressions to callable numerical functions.
Ex::compile lowers one or more expressions into a compact stack-VM
program after a shared common-subexpression-elimination
pass. The program is wrapped in CompiledFn (scalar) or
CompiledFnVec (vector-valued) handles that are Clone + Send + Sync
and evaluate without touching the arena or taking any locks.
Every numerically evaluable [ExprNode] is supported, including the
special functions (Γ, ln Γ, ψ, erf/erfc, Lambert W, Beta, factorials,
binomials), Bessel functions and orthogonal polynomials with integer
order, integer sequences, piecewise expressions and boolean/relational
nodes (represented as 0.0/1.0). The special-function algorithms live
in the crate-internal numeric_rt module and are shared with
the Rust code generator, so compile() and to_rust_fn() agree bit for
bit on those routines.
The compiler never recurses over the expression tree — it uses an explicit work stack — so arbitrarily deep expressions are safe.
Structs§
- Compiled
Fn - A compiled scalar function
f(x₁, …, xₙ) → f64. - Compiled
FnVec - A compiled vector-valued function
F(x₁, …, xₙ) → (f₁, …, fₖ).