Trait rmpfit::MPFitter

source ·
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§

source

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].

source

fn number_of_points(&self) -> usize

Number of the data points in the user private data.

Provided Methods§

source

fn config(&self) -> MPConfig

Returns a default config It should be reimplemented if user needs a custom config

source

fn parameters(&self) -> Option<&[MPPar]>

Parameters for fitted values User must reimplement this method if the custom parameters are needed

source

fn mpfit(&mut self, xall: &mut [f64]) -> MPResult<MPStatus>where Self: Sized,

Main function to refine the parameters.

Arguments
  • xall - A mutable slice with starting fit parameters

Implementors§