pub struct Minimizer<T> { /* private fields */ }
Implementations§
source§impl<T> Minimizer<T>
impl<T> Minimizer<T>
sourcepub fn new(t: &MinimizerType<T>) -> Option<Minimizer<T>>
pub fn new(t: &MinimizerType<T>) -> Option<Minimizer<T>>
This function returns a pointer to a newly allocated instance of a minimizer of type T. For example, the following code creates an instance of a golden section minimizer,
const gsl_min_fminimizer_type * T
= gsl_min_fminimizer_goldensection;
gsl_min_fminimizer * s
= gsl_min_fminimizer_alloc (T);
If there is insufficient memory to create the minimizer then the function returns a null pointer and the error handler is invoked with an error code of ::NoMem.
sourcepub fn set(
&mut self,
f: function<T>,
arg: &mut T,
x_minimum: f64,
x_lower: f64,
x_upper: f64
) -> Value
pub fn set(
&mut self,
f: function<T>,
arg: &mut T,
x_minimum: f64,
x_lower: f64,
x_upper: f64
) -> Value
This function sets, or resets, an existing minimizer s to use the function f and the initial search interval [x_lower, x_upper], with a guess for the location of the minimum x_minimum.
If the interval given does not contain a minimum, then the function returns an error code of ::Value::Invalid.
sourcepub fn set_with_values(
&mut self,
f: function<T>,
arg: &mut T,
x_minimum: f64,
f_minimum: f64,
x_lower: f64,
f_lower: f64,
x_upper: f64,
f_upper: f64
) -> Value
pub fn set_with_values(
&mut self,
f: function<T>,
arg: &mut T,
x_minimum: f64,
f_minimum: f64,
x_lower: f64,
f_lower: f64,
x_upper: f64,
f_upper: f64
) -> Value
This function is equivalent to gsl_min_fminimizer_set but uses the values f_minimum, f_lower and f_upper instead of computing f(x_minimum), f(x_lower) and f(x_upper).
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
This function returns a pointer to the name of the minimizer. For example,
printf("s is a '%s' minimizer\n", gsl_min_fminimizer_name (s));
would print something like s is a ‘brent’ minimizer.
sourcepub fn x_minimum(&self) -> f64
pub fn x_minimum(&self) -> f64
This function returns the current estimate of the position of the minimum for the minimizer s.
sourcepub fn x_lower(&self) -> f64
pub fn x_lower(&self) -> f64
This function returns the current upper and lower bound of the interval for the minimizer s.
sourcepub fn x_upper(&self) -> f64
pub fn x_upper(&self) -> f64
/// This function returns the current upper and lower bound of the interval for the minimizer s.
sourcepub fn f_minimum(&self) -> f64
pub fn f_minimum(&self) -> f64
This function returns the value of the function at the current estimate of the minimum and at the upper and lower bounds of the interval for the minimizer s.
sourcepub fn f_lower(&self) -> f64
pub fn f_lower(&self) -> f64
This function returns the value of the function at the current estimate of the minimum and at the upper and lower bounds of the interval for the minimizer s.
sourcepub fn f_upper(&self) -> f64
pub fn f_upper(&self) -> f64
This function returns the value of the function at the current estimate of the minimum and at the upper and lower bounds of the interval for the minimizer s.
sourcepub fn iterate(&mut self) -> Value
pub fn iterate(&mut self) -> Value
This function performs a single iteration of the minimizer s. If the iteration encounters an unexpected problem then an error code will be returned,
::Value::BadFunc the iteration encountered a singular point where the function evaluated to Inf or NaN.
::Value::Failure the algorithm could not improve the current best approximation or bounding interval.
The minimizer maintains a current best estimate of the position of the minimum at all times, and the current interval bounding the minimum. This information can be accessed with the following auxiliary functions,