Struct varpro::solvers::levmar::LevMarProblem [−][src]
This is a the problem of fitting the separable model to data in a form that the levenberg_marquardt crate can use it to perform the least squares fit.
Construction
Use the LevMarProblemBuilder to create an instance of a levmar problem.
Usage
After obtaining an instance of LevMarProblem
we can pass it to the LevenbergMarquardt
structure of the levenberg_marquardt crate for minimization. Refer to the documentation of the
levenberg_marquardt for an overview. A usage example
is provided in this crate documentation as well. The LevenbergMarquardt
solver is reexported by this module as LevMarSolver for naming consistency.
Implementations
impl<'a, ScalarType: Scalar + ComplexField> LevMarProblem<'a, ScalarType>
[src]
pub fn linear_coefficients(&self) -> Option<DVector<ScalarType>>
[src]
Get the linear coefficients for the current problem. After a successful pass of the solver, this contains a value with the best fitting linear coefficients
Returns
Either the current best estimate coefficients or None, if none were calculated or the solver encountered an error. After the solver finished, this is the least squares best estimate for the linear coefficients of the base functions.
Trait Implementations
impl<'a, ScalarType: Clone> Clone for LevMarProblem<'a, ScalarType> where
ScalarType: Scalar + ComplexField,
ScalarType::RealField: Clone,
[src]
ScalarType: Scalar + ComplexField,
ScalarType::RealField: Clone,
fn clone(&self) -> LevMarProblem<'a, ScalarType>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, ScalarType> LeastSquaresProblem<ScalarType, Dynamic, Dynamic> for LevMarProblem<'a, ScalarType> where
ScalarType: Scalar + ComplexField,
ScalarType::RealField: Mul<ScalarType, Output = ScalarType> + Float,
[src]
ScalarType: Scalar + ComplexField,
ScalarType::RealField: Mul<ScalarType, Output = ScalarType> + Float,
type ResidualStorage = Owned<ScalarType, Dynamic>
Storage type used for the residuals. Use nalgebra::storage::Owned<F, M>
if you want to use VectorN
or MatrixMN
. Read more
type JacobianStorage = Owned<ScalarType, Dynamic, Dynamic>
type ParameterStorage = Owned<ScalarType, Dynamic>
fn set_params(
&mut self,
params: &Vector<ScalarType, Dynamic, Self::ParameterStorage>
)
[src]
&mut self,
params: &Vector<ScalarType, Dynamic, Self::ParameterStorage>
)
Set the (nonlinear) model parameters $\vec{\alpha}$
and update the internal state of the
problem accordingly. The parameters are expected in the same order that the parameter
names were provided in at model creation. So if we gave &["tau","beta"]
as parameters at
model creation, the function expects the layout of the parameter vector to be $\vec{\alpha}=(\tau,\beta)^T$
.
fn params(&self) -> Vector<ScalarType, Dynamic, Self::ParameterStorage>
[src]
Retrieve the (nonlinear) model parameters as a vector $\vec{\alpha}$
.
The order of the parameters in the vector is the same as the order of the parameter
names given on model creation. E.g. if the parameters at model creation where given as
&["tau","beta"]
, then the returned vector is $\vec{\alpha} = (\tau,\beta)^T$
, i.e.
the value of parameter $\tau$
is at index 0
and the value of $\beta$
at index 1
.
fn residuals(
&self
) -> Option<Vector<ScalarType, Dynamic, Self::ResidualStorage>>
[src]
&self
) -> Option<Vector<ScalarType, Dynamic, Self::ResidualStorage>>
Calculate the residual vector $\vec{r}_w$
of weighted residuals at every location $\vec{x}$
.
The residual is calculated from the data \vec{y}
as $\vec{r}_w(\vec{\alpha}) = W\cdot(\vec{y}-\vec{f}(\vec{x},\vec{\alpha},\vec{c}(\vec{\alpha}))$
,
where $\vec{f}(\vec{x},\vec{\alpha},\vec{c})$
is the model function evaluated at the currently
set nonlinear parameters $\vec{\alpha}$
and the linear coefficients $\vec{c}(\vec{\alpha})$
. The VarPro
algorithm calculates $\vec{c}(\vec{\alpha})$
as the coefficients that provide the best linear least squares
fit, given the current $\vec{\alpha}$
. For more info on the math of VarPro, see
e.g. here.
fn jacobian(
&self
) -> Option<Matrix<ScalarType, Dynamic, Dynamic, Self::JacobianStorage>>
[src]
&self
) -> Option<Matrix<ScalarType, Dynamic, Dynamic, Self::JacobianStorage>>
Calculate the Jacobian matrix of the weighted residuals $\vec{r}_w(\vec{\alpha})$
.
For more info on how the Jacobian is calculated in the VarPro algorithm, see
e.g. here.
Auto Trait Implementations
impl<'a, ScalarType> !RefUnwindSafe for LevMarProblem<'a, ScalarType>
impl<'a, ScalarType> !Send for LevMarProblem<'a, ScalarType>
impl<'a, ScalarType> !Sync for LevMarProblem<'a, ScalarType>
impl<'a, ScalarType> Unpin for LevMarProblem<'a, ScalarType> where
ScalarType: Unpin,
<ScalarType as ComplexField>::RealField: Unpin,
ScalarType: Unpin,
<ScalarType as ComplexField>::RealField: Unpin,
impl<'a, ScalarType> !UnwindSafe for LevMarProblem<'a, ScalarType>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,