GaussNewton

Struct GaussNewton 

Source
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>,

Source

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.

Source

pub fn with_tol(&mut self, tol: T) -> &mut Self

Updates the solver’s tolerance (Magnitude of Error).

Default Tolerance: 1e-6

Source

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

Source

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>
where F: Freeze, J: Freeze, T: Freeze,

§

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>
where F: Send, J: Send, T: Send, R: Send, C: Send,

§

impl<T, R, C, F, J> Sync for GaussNewton<T, R, C, F, J>
where F: Sync, J: Sync, T: Sync, R: Sync, C: Sync,

§

impl<T, R, C, F, J> Unpin for GaussNewton<T, R, C, F, J>
where F: Unpin, J: Unpin, T: Unpin, R: Unpin, C: Unpin,

§

impl<T, R, C, F, J> UnwindSafe for GaussNewton<T, R, C, F, J>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V