pub fn adam(
f: impl Fn(&[f64]) -> f64,
grad: impl Fn(&[f64]) -> Vec<f64>,
x0: Vec<f64>,
lr: f64,
beta1: f64,
beta2: f64,
eps: f64,
max_iter: u32,
) -> OptResultExpand description
Adam adaptive-moment optimizer.
Uses the standard Adam update rule with bias correction.
Stops when the L2 norm of the gradient falls below the default tolerance
1e-7, or after max_iter steps (no separate tol parameter because
Adam is typically used for a fixed budget).