Skip to main content

evaluate_compiled_indexed

Function evaluate_compiled_indexed 

Source
pub fn evaluate_compiled_indexed(
    cg: &CompiledGraph,
    node_params: &[Vec<f64>],
    x: &[f64],
) -> Result<Vec<f64>, CoreError>
Expand description

Evaluate the model sum using pre-computed per-node parameter buffers.

This is the hot-path version of evaluate_compiled used by the solver. The caller maintains node_params[i] (one Vec<f64> per node, in model param_names() order) and updates only the free-param slots on each iteration, using a free-param-index → (node_idx, param_pos) mapping it builds and owns itself (spectrafit-solver’s LmProblem::free_to_node_param).

Eliminates all HashMap lookups from the inner loop.

§Errors

Returns CoreError::Eval if x.len() is not an exact multiple of the graph’s coordinate dimensionality (GraphError::XBufferStrideMismatch) or the graph’s nodes disagree on n_dims (GraphError::DimensionalityMismatch).