pub struct GaussNewton<T, R, C, F, J> { /* private fields */ }Expand description
§Gauss-Newton
Solves x in a system of equation F(x) = 0 (where F: Rm ⟶ Rn) by minimizing ||F(x)|| in a least square sense using The Gauss-Newton algorithm (Wikipedia). This struct uses a closure that takes a nalgebra vector (size m) and outputs a nalgebra vector (size n) to represent the overdetermined system of equations. The struct also uses the Jacobian of F, that is represented by a closure taking a nalgebra vector (size m) and outputs a nalgebra matrix of size n x m.
Default Tolerance: 1e-6
Default Max Iterations: 50
Implementations§
Source§impl<T, R, C, F, J> GaussNewton<T, R, C, F, J>where
T: Float + ComplexField<RealField = T> + Signed,
R: Dim,
C: Dim,
F: Fn(Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>) -> Vector<T, R, <DefaultAllocator as Allocator<R>>::Buffer<T>>,
J: Fn(Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>) -> Matrix<T, R, C, <DefaultAllocator as Allocator<R, C>>::Buffer<T>>,
DefaultAllocator: Allocator<C> + Allocator<R> + Allocator<R, C> + Allocator<C, R> + Allocator<C, C>,
impl<T, R, C, F, J> GaussNewton<T, R, C, F, J>where
T: Float + ComplexField<RealField = T> + Signed,
R: Dim,
C: Dim,
F: Fn(Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>) -> Vector<T, R, <DefaultAllocator as Allocator<R>>::Buffer<T>>,
J: Fn(Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>) -> Matrix<T, R, C, <DefaultAllocator as Allocator<R, C>>::Buffer<T>>,
DefaultAllocator: Allocator<C> + Allocator<R> + Allocator<R, C> + Allocator<C, R> + Allocator<C, C>,
Sourcepub fn new(f: F, j: J) -> Self
pub fn new(f: F, j: J) -> Self
Create a new instance of the algorithm
Instantiates the Gauss-Newton algorithm using the system of equation F and its Jacobian J.
Sourcepub fn with_tol(&mut self, tol: T) -> &mut Self
pub fn with_tol(&mut self, tol: T) -> &mut Self
Updates the solver’s tolerance (Magnitude of Error).
Default Tolerance: 1e-6
Sourcepub fn with_itermax(&mut self, max: usize) -> &mut Self
pub fn with_itermax(&mut self, max: usize) -> &mut Self
Updates the solver’s amount of iterations done before terminating the iteration
Default Max Iterations: 50
Sourcepub fn solve(
&self,
x0: Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>,
) -> SolverResult<Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>>
pub fn solve( &self, x0: Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>, ) -> SolverResult<Vector<T, C, <DefaultAllocator as Allocator<C>>::Buffer<T>>>
Run the algorithm
Finds x such that ||F(x)|| is minimized where F is the overdetermined system of equations.
Auto Trait Implementations§
impl<T, R, C, F, J> Freeze for GaussNewton<T, R, C, F, J>
impl<T, R, C, F, J> RefUnwindSafe for GaussNewton<T, R, C, F, J>
impl<T, R, C, F, J> Send for GaussNewton<T, R, C, F, J>
impl<T, R, C, F, J> Sync for GaussNewton<T, R, C, F, J>
impl<T, R, C, F, J> Unpin for GaussNewton<T, R, C, F, J>
impl<T, R, C, F, J> UnwindSafe for GaussNewton<T, R, C, F, J>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.