pub fn approximate_gradient<F>(x0: &[f64], f: F, grad: &mut [f64])
where F: Fn(&[f64]) -> f64,
Expand description

Helper function to calculate gradient of function numerically. Can be useful when a gradient must be provided to the optimization algorithm and a closed-form derivative cannot be obtained