pub struct CurveFit<F: Fn(&f64, &[f64]) -> f64> { /* private fields */ }Expand description
Object to create a CurveFit with all required parameters.
Implementations§
source§impl<F: Fn(&f64, &[f64]) -> f64> CurveFit<F>
impl<F: Fn(&f64, &[f64]) -> f64> CurveFit<F>
sourcepub fn new(
model: F,
x_values: impl Into<Vec<f64>>,
y_values: impl Into<Vec<f64>>
) -> Self
pub fn new( model: F, x_values: impl Into<Vec<f64>>, y_values: impl Into<Vec<f64>> ) -> Self
Constructs a new CurveFit with some default values that can be changed.
sourcepub fn initial_point(self, initial_point: impl Into<Vec<f64>>) -> Self
pub fn initial_point(self, initial_point: impl Into<Vec<f64>>) -> Self
Initial points required for calculating the curve fit.
sourcepub fn y_error(self, yerr: Vec<f64>) -> Self
pub fn y_error(self, yerr: Vec<f64>) -> Self
If passed, calculates the weigthed curve fit considaring the y error.
sourcepub fn max_iterations(self, max_iterations: impl Into<Option<usize>>) -> Self
pub fn max_iterations(self, max_iterations: impl Into<Option<usize>>) -> Self
In case you want the curve fit algorithm to stop at some point, by default None.
sourcepub fn initial_zeros(self, number_of_components: usize) -> Self
pub fn initial_zeros(self, number_of_components: usize) -> Self
Set initial points to zero.
sourcepub fn initial_ones(self, number_of_components: usize) -> Self
pub fn initial_ones(self, number_of_components: usize) -> Self
Set initial points to one.
sourcepub fn tolerance(self, tol: impl Into<f64>) -> Self
pub fn tolerance(self, tol: impl Into<f64>) -> Self
Custom precision on the curve fit, by default 1e-6.
sourcepub fn initial_simplex_scale(self, scale: impl Into<f64>) -> Self
pub fn initial_simplex_scale(self, scale: impl Into<f64>) -> Self
Generates n+1 points using the initial one for calculating the curve fit, by default 0.5. If the scale is a lot smaller than the expected value of the coeficients it may result in errors in the fit.
sourcepub fn fit(&self) -> Vec<Measure>
pub fn fit(&self) -> Vec<Measure>
Takes the arbitrary function and aproximates to the curve using every parameter established.
pub fn r_value(&self) -> f64
Trait Implementations§
Auto Trait Implementations§
impl<F> RefUnwindSafe for CurveFit<F>where
F: RefUnwindSafe,
impl<F> Send for CurveFit<F>where
F: Send,
impl<F> Sync for CurveFit<F>where
F: Sync,
impl<F> Unpin for CurveFit<F>where
F: Unpin,
impl<F> UnwindSafe for CurveFit<F>where
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more