Skip to main content

jacobian_compiled

Function jacobian_compiled 

Source
pub fn jacobian_compiled(
    cg: &CompiledGraph,
    flat: &HashMap<String, f64>,
    x: &[f64],
) -> Result<DMatrix<f64>, CoreError>
Expand description

Compute the analytical Jacobian matrix using a pre-built flat param map.

Layout: row i = x-point i; column j = free parameter j (ordered as in cg.free_keys).

Only parameters with free_mask == true contribute a column. Fixed and expression-bound parameters are excluded.

Uses cg.node_free_cols (pre-computed at compile time) to avoid string-parsing free_keys on every call.

§Errors

Returns CoreError::Eval if: flat is missing a required "node_id.param_name" entry for some node (GraphError::MissingParamKey); x.len() is not an exact multiple of the graph’s coordinate dimensionality (GraphError::XBufferStrideMismatch); the graph’s nodes disagree on n_dims (GraphError::DimensionalityMismatch); or, when multi-dataset scoping is active, a node’s dataset_index is out of range (GraphError::DatasetIndexOutOfRange).