pub trait MPFitter {
// Required methods
fn eval(&mut self, params: &[f64], deviates: &mut [f64]) -> MPResult<()>;
fn number_of_points(&self) -> usize;
// Provided methods
fn config(&self) -> MPConfig { ... }
fn parameters(&self) -> Option<&[MPPar]> { ... }
fn mpfit(&mut self, xall: &mut [f64]) -> MPResult<MPStatus>
where Self: Sized { ... }
}
Expand description
Trait to be implemented by user.
Required Methods§
sourcefn eval(&mut self, params: &[f64], deviates: &mut [f64]) -> MPResult<()>
fn eval(&mut self, params: &[f64], deviates: &mut [f64]) -> MPResult<()>
Main evaluation procedure which is called from mpfit
. Size of deviates
is equal
to the value returned by number_of_points
. User should compute the residuals
using parameters from params
and any user data that are required, and fill
the deviates
slice.
The residuals are defined as (y[i] - f(x[i]))/y_error[i]
.
sourcefn number_of_points(&self) -> usize
fn number_of_points(&self) -> usize
Number of the data points in the user private data.
Provided Methods§
sourcefn config(&self) -> MPConfig
fn config(&self) -> MPConfig
Returns a default config It should be reimplemented if user needs a custom config
sourcefn parameters(&self) -> Option<&[MPPar]>
fn parameters(&self) -> Option<&[MPPar]>
Parameters for fitted values User must reimplement this method if the custom parameters are needed