pub fn descend<X: Clone, E: From<GeopError>, D: Fn(Scalar) -> X>(
start: X,
steps: usize,
halvings: usize,
merit: impl Fn(&X) -> Result<f64, E>,
direction: impl FnMut(&X) -> Result<Option<D>, E>,
) -> Result<X, E>Expand description
Damped descent from start, at most steps steps. direction(x)
gives the step from x as the point it leads to at a scale of the
full step (None where there is none to take); a step is taken at the
first of 1, 1/2, 1/4, … (halvings of them) at which it definitely
lowers merit, and the descent stops where none does. What is
returned is never worse than start.