pub struct MultiRootFSolverType { /* private fields */ }
Expand description
The multiroot algorithms described in this section do not require any derivative information to be supplied by the user. Any derivatives needed are approximated by finite differences. Note that if the finite-differencing step size chosen by these routines is inappropriate, an explicit user-supplied numerical derivative can always be used with derivative-based algorithms.
Implementations
sourceimpl MultiRootFSolverType
impl MultiRootFSolverType
sourcepub fn hybrids() -> MultiRootFSolverType
pub fn hybrids() -> MultiRootFSolverType
This is a version of the Hybrid algorithm which replaces calls to the Jacobian function by
its finite difference approximation. The finite difference approximation is computed
using gsl_multiroots_fdjac()
with a relative step size of GSL_SQRT_DBL_EPSILON
.
Note that this step size will not be suitable for all problems.
sourcepub fn hybrid() -> MultiRootFSolverType
pub fn hybrid() -> MultiRootFSolverType
This is a finite difference version of the Hybrid algorithm without internal scaling.
sourcepub fn dnewton() -> MultiRootFSolverType
pub fn dnewton() -> MultiRootFSolverType
The discrete Newton algorithm is the simplest method of solving a multidimensional system. It uses the Newton iteration
x \to x - J^{-1} f(x)
where the Jacobian matrix J is approximated by taking finite differences of the function f. The approximation scheme used by this implementation is,
J_{ij} = (f_i(x + \delta_j) - f_i(x)) / \delta_j
where \delta_j is a step of size \sqrt\epsilon |x_j| with \epsilon being the machine precision (\epsilon \approx 2.22 \times 10^{-16}). The order of convergence of Newton’s algorithm is quadratic, but the finite differences require n^2 function evaluations on each iteration. The algorithm may become unstable if the finite differences are not a good approximation to the true derivatives.
sourcepub fn broyden() -> MultiRootFSolverType
pub fn broyden() -> MultiRootFSolverType
The Broyden algorithm is a version of the discrete Newton algorithm which attempts to avoids the expensive update of the Jacobian matrix on each iteration. The changes to the Jacobian are also approximated, using a rank-1 update,
J^{-1} \to J^{-1} - (J^{-1} df - dx) dx^T J^{-1} / dx^T J^{-1} df
where the vectors dx and df are the changes in x and f. On the first iteration the inverse Jacobian is estimated using finite differences, as in the discrete Newton algorithm.
This approximation gives a fast update but is unreliable if the changes are not small, and the estimate of the inverse Jacobian becomes worse as time passes. The algorithm has a tendency to become unstable unless it starts close to the root. The Jacobian is refreshed if this instability is detected (consult the source for details).
This algorithm is included only for demonstration purposes, and is not recommended for serious use.
Trait Implementations
sourceimpl Clone for MultiRootFSolverType
impl Clone for MultiRootFSolverType
sourcefn clone(&self) -> MultiRootFSolverType
fn clone(&self) -> MultiRootFSolverType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for MultiRootFSolverType
Auto Trait Implementations
impl RefUnwindSafe for MultiRootFSolverType
impl !Send for MultiRootFSolverType
impl !Sync for MultiRootFSolverType
impl Unpin for MultiRootFSolverType
impl UnwindSafe for MultiRootFSolverType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more