pub fn curve_fit_jac<N, F, G, const V: usize>(
f: F,
xs: &[N],
ys: &[N],
initial: &[N],
jacobian: G,
params: &CurveFitParams<N>,
) -> Result<SVector<N, V>, String>where
N: ComplexField + FromPrimitive + Copy,
<N as ComplexField>::RealField: FromPrimitive + Copy,
F: FnMut(N, &SVector<N, V>) -> N,
G: FnMut(N, &SVector<N, V>) -> SVector<N, V>,
Expand description
Fit a curve using the Levenberg-Marquardt algorithm.
Uses an analytic jacobian.Keeps iterating until the differences between the sum of the square residuals of two iterations is under tol. Jacobian should be a function that returns a column vector where jacobian[i] is the partial derivative of f with respect to param[i].
§Errors
Returns an error if curve fit fails.
§Panics
Panics if a u8 can not be converted to the generic type.