Skip to main content

conjugate_gradient

Function conjugate_gradient 

Source
pub fn conjugate_gradient(
    cfg: &OptimConfig,
    f: &dyn Fn(&[f64]) -> f64,
    grad: Option<&dyn Fn(&[f64]) -> Vec<f64>>,
    x0: &[f64],
) -> OptimResult
Expand description

Minimize f from x0 by Polak-Ribiere conjugate gradient with the beta >= 0 safeguard (automatic restart to steepest descent). grad falls back to central finite differences when absent.