pub fn curve_fit<N, F, const V: usize>(
f: F,
xs: &[N],
ys: &[N],
initial: &[N],
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,
Expand description
Fit a curve using the Levenberg-Marquardt algorithm.
Uses finite differences of h to calculate the jacobian. If jacobian
can be found analytically, then use curve_fit_jac
. Keeps iterating until
the differences between the sum of the square residuals of two iterations
is under tol.
§Errors
Returns an error if curve fitting fails.
§Panics
Panics if a u8 can not be converted to the generic type.