Skip to main content

batch_eval

Function batch_eval 

Source
pub fn batch_eval(
    func: CompiledExprFn,
    var_sets: &[f64],
    num_vars: usize,
    results: &mut [f64],
) -> Result<(), BatchError>
Expand description

Evaluates a JIT-compiled expression for each row of var_sets.

var_sets is a row-major matrix with results.len() rows and num_vars columns. results[i] receives func(&var_sets[i * num_vars..]).

This bridges the JIT single-eval path with batch processing patterns: callers can tabulate a compiled expression over a grid of inputs, run Monte Carlo sampling, or compare the JIT path to a SIMD-vectorized path by stacking this with batch_add / batch_mul on the result slice.

ยงErrors

Returns BatchError::LengthMismatch when var_sets.len() != results.len() * num_vars.