Skip to main content

LineSearch

Trait LineSearch 

Source
pub trait LineSearch<V: Vector>: Default {
    // Required methods
    fn take_optimal_step(
        &mut self,
        x: &mut V,
        delta: &mut V,
        error_y: &V,
        fun: &impl Fn(&V, &mut V),
        linear_solver: &impl Fn(&mut V) -> Result<(), DiffsolError>,
        convergence: &mut Convergence<'_, V>,
    ) -> Result<ConvergenceStatus, DiffsolError>;
    fn reset(&mut self);
}
Expand description

Line search trait for nonlinear solvers The line search is used to find an optimal step size for the Newton iteration. The line search modifies the delta vector in place to scale it by the optimal step size The line search returns the norm of the modified delta vector The x vector is also modified in place to take the optimal step

Required Methods§

Source

fn take_optimal_step( &mut self, x: &mut V, delta: &mut V, error_y: &V, fun: &impl Fn(&V, &mut V), linear_solver: &impl Fn(&mut V) -> Result<(), DiffsolError>, convergence: &mut Convergence<'_, V>, ) -> Result<ConvergenceStatus, DiffsolError>

Take the optimal step for the current iteration

§Arguments
  • x: current solution vector, modified in place to take the optimal step
  • delta: current Newton step vector, modified in place to scale by the optimal step size (previous value is overwritten)
  • error_y: current error estimate vector, used to compute the norm
  • fun: function to compute the residual F(x), takes x and modifies delta in place
  • linear_solver: function to solve the linear system J delta = -F(x), takes delta and modifies it in place
  • convergence: convergence object to compute norms and check convergence
§Returns
  • ConvergenceStatus: status of the convergence after taking the optimal step
  • DiffsolError: error if the line search fails
Source

fn reset(&mut self)

Reset the line search state

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§