rgsl/
minimizer.rs

1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5use crate::Value;
6
7/// This function tests for the convergence of the interval [x_lower, x_upper] with absolute error epsabs and relative error epsrel. The
8/// test returns crate::Value::Success if the following condition is achieved,
9///
10/// ```text
11/// |a - b| < epsabs + epsrel min(|a|,|b|)
12/// ```
13///
14/// when the interval x = [a,b] does not include the origin. If the interval includes the origin then \min(|a|,|b|) is replaced by zero (
15/// which is the minimum value of |x| over the interval). This ensures that the relative error is accurately estimated for minima close to
16/// the origin.
17///
18/// This condition on the interval also implies that any estimate of the minimum x_m in the interval satisfies the same condition with
19/// respect to the true minimum x_m^*,
20///
21/// ```text
22/// |x_m - x_m^*| < epsabs + epsrel x_m^*
23/// ```
24///
25/// assuming that the true minimum x_m^* is contained within the interval.
26#[doc(alias = "gsl_min_test_interval")]
27pub fn test_interval(x_lower: f64, x_upper: f64, epsabs: f64, epsrel: f64) -> Value {
28    Value::from(unsafe { sys::gsl_min_test_interval(x_lower, x_upper, epsabs, epsrel) })
29}