Trait Residuals

Source
pub trait Residuals {
    // Required methods
    fn residual_count(&self) -> usize;
    fn residuals(&mut self, x: &[f64], out: &mut [f64]);

    // Provided method
    fn jacobian(&mut self, x: &[f64], out: &mut Matrix) { ... }
}
Expand description

A vector-valued residual function r: R^n -> R^m for levenberg_marquardt.

Required Methods§

Source

fn residual_count(&self) -> usize

m, the number of residuals.

Source

fn residuals(&mut self, x: &[f64], out: &mut [f64])

Write r(x) into out (length m).

Provided Methods§

Source

fn jacobian(&mut self, x: &[f64], out: &mut Matrix)

Write the Jacobian dr_i / dx_j into out (m x n).

The default is forward differences with step sqrt(eps) max(|x_j|, 1); supply the analytic Jacobian where it is available, since differences cost n evaluations and half the digits.

Implementors§