Skip to main content

NonLinearSolver

Trait NonLinearSolver 

Source
pub trait NonLinearSolver<M: Matrix>: Default {
    // Required methods
    fn set_problem<C: NonLinearOpJacobian<V = M::V, T = M::T, M = M, C = M::C>>(
        &mut self,
        op: &C,
    );
    fn is_jacobian_set(&self) -> bool;
    fn reset_jacobian<C: NonLinearOpJacobian<V = M::V, T = M::T, M = M, C = M::C>>(
        &mut self,
        op: &C,
        x: &M::V,
    );
    fn clear_jacobian(&mut self);
    fn solve_in_place<C: NonLinearOp<V = M::V, T = M::T, M = M>>(
        &mut self,
        op: &C,
        x: &mut C::V,
        error_y: &C::V,
        convergence: &mut Convergence<'_, M::V>,
    ) -> Result<(), NlError>;
    fn solve_linearised_in_place(&self, x: &mut M::V) -> Result<(), NlError>;

    // Provided method
    fn solve<C: NonLinearOp<V = M::V, T = M::T, M = M>>(
        &mut self,
        op: &C,
        x: &M::V,
        error_y: &M::V,
        convergence: &mut Convergence<'_, M::V>,
    ) -> Result<M::V, NlError> { ... }
}
Expand description

A solver for the nonlinear problem F(x) = 0.

Required Methods§

Source

fn set_problem<C: NonLinearOpJacobian<V = M::V, T = M::T, M = M, C = M::C>>( &mut self, op: &C, )

Set the problem to be solved, any previous problem is discarded.

Source

fn is_jacobian_set(&self) -> bool

Source

fn reset_jacobian<C: NonLinearOpJacobian<V = M::V, T = M::T, M = M, C = M::C>>( &mut self, op: &C, x: &M::V, )

Reset the approximation of the Jacobian matrix.

Source

fn clear_jacobian(&mut self)

Clear the approximation of the Jacobian matrix.

Source

fn solve_in_place<C: NonLinearOp<V = M::V, T = M::T, M = M>>( &mut self, op: &C, x: &mut C::V, error_y: &C::V, convergence: &mut Convergence<'_, M::V>, ) -> Result<(), NlError>

Solve the problem F(x) = 0 in place.

Source

fn solve_linearised_in_place(&self, x: &mut M::V) -> Result<(), NlError>

Solve the linearised problem J * x = b, where J was calculated using Self::reset_jacobian. The input b is provided in x, and the solution is returned in x.

Provided Methods§

Source

fn solve<C: NonLinearOp<V = M::V, T = M::T, M = M>>( &mut self, op: &C, x: &M::V, error_y: &M::V, convergence: &mut Convergence<'_, M::V>, ) -> Result<M::V, NlError>

Solve the problem F(x) = 0 and return the solution x.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M: Matrix, Ls: LinearSolver<M>, Lsearch: LineSearch<M::V>> NonLinearSolver<M> for NewtonNonlinearSolver<M, Ls, Lsearch>