pub fn gradient_descent(
f: impl Fn(&[f64]) -> f64,
grad: impl Fn(&[f64]) -> Vec<f64>,
x0: Vec<f64>,
lr: f64,
tol: f64,
max_iter: u32,
) -> OptResultExpand description
Gradient descent with fixed learning rate.
Minimises f starting from x0 using the gradient grad.
Stops when the L2 norm of the gradient is below tol.