Struct rusfun::curve_fit::Minimizer[][src]

pub struct Minimizer<'a> {
Show fields pub model: &'a Func1D<'a>, pub y: &'a Array1<f64>, pub sy: &'a Array1<f64>, pub vary_parameter: &'a Array1<bool>, pub weighting_matrix: Array1<f64>, pub minimizer_parameters: Array1<f64>, pub minimizer_ymodel: Array1<f64>, pub jacobian: Array2<f64>, pub parameter_cov_matrix: Array2<f64>, pub parameter_errors: Array1<f64>, pub lambda: f64, pub num_func_evaluation: usize, pub max_iterations: usize, pub num_varying_params: usize, pub num_params: usize, pub num_data: usize, pub chi2: f64, pub dof: usize, pub redchi2: f64, pub convergence_message: &'a str, pub epsilon1: f64, pub epsilon2: f64, pub epsilon3: f64, pub epsilon4: f64, pub lambda_UP_fac: f64, pub lambda_DOWN_fac: f64,
}
Expand description

Container to perform a curve fit for model, given y and & sy

The Minimizer is used to initialize and perform a curve fit. For now only 1-dim functions and a Levenberg-Marquardt algorithm is implemented for test purposes. Results have only been verified on simple functions by comparison with an LM implementation from MINPACK.

Fields

model: &'a Func1D<'a>y: &'a Array1<f64>sy: &'a Array1<f64>vary_parameter: &'a Array1<bool>weighting_matrix: Array1<f64>minimizer_parameters: Array1<f64>minimizer_ymodel: Array1<f64>jacobian: Array2<f64>parameter_cov_matrix: Array2<f64>parameter_errors: Array1<f64>lambda: f64num_func_evaluation: usizemax_iterations: usizenum_varying_params: usizenum_params: usizenum_data: usizechi2: f64dof: usizeredchi2: f64convergence_message: &'a strepsilon1: f64epsilon2: f64epsilon3: f64epsilon4: f64lambda_UP_fac: f64lambda_DOWN_fac: f64

Implementations

impl<'a> Minimizer<'a>[src]

pub fn init<'b>(
    model: &'b Func1D<'_>,
    y: &'b Array1<f64>,
    sy: &'b Array1<f64>,
    vary_parameter: &'b Array1<bool>,
    lambda: f64
) -> Minimizer<'b>
[src]

Initializes the LM-algorithm. Performs first calculation of model & gradient

pub fn lm(&mut self) -> MinimizationStep[src]

Performs a Levenberg Marquardt step

determine change to parameters by solving the equation [J^T W J + lambda diag(J^T W J)] delta = J^T W (y - f) for delta

pub fn minimize(&mut self)[src]

Fit routine that performs LM steps until one convergence criteria is met

Follows the description from http://people.duke.edu/~hpgavin/ce281/lm.pdf

pub fn report(&self)[src]

Prints report of a performed fit

pub fn calculate_R2(&self) -> f64[src]

Calculate the coefficient of determination

Auto Trait Implementations

impl<'a> RefUnwindSafe for Minimizer<'a>

impl<'a> Send for Minimizer<'a>

impl<'a> Sync for Minimizer<'a>

impl<'a> Unpin for Minimizer<'a>

impl<'a> UnwindSafe for Minimizer<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.