Module rootfind::convergence
[−]
[src]
Convergence criteria.
This module defines the convergence criteria used to stop iterative root
finders. Users can supply custom criteria by implementing the IsConverged
trait.
This module also supplies two canned criteria:
- DeltaX - stops when the steps along x-axis, |x_pre - x_cur|, gets small enough.
- FnResidual - stops when |f(x_cur)| gets small enough.
It also provides a generic wrapper DualCriteria
allowing two
IsConverged implementations to be combined.
Examples
use rootfind::convergence::*; let c1 = DeltaX::new(1e-6); let c2 = FnResidual::new(1e-9); let finish = DualCriteria::new(&c1, &c2); // c1 satisfied but not c2 assert_eq!(finish.is_converged(0.1, 0.1+1e-7, 1e-8), false); // both required conditions satisfied assert_eq!(finish.is_converged(0.1, 0.1+1e-7, 1e-12), true);
Structs
DeltaX |
DeltaX converges when the distance along the x-axis between successive iterations becomes smaller than epsilon_abs. |
DualCriteria |
DualCriteria combines two IsConverged implementors. |
FnResidual |
FnResidual converges when the residual is small: |f(x_cur)| < epsilon_abs. |
Traits
IsConverged |
Type can check if iterative root-finding process has converged. |