Struct rgsl::types::minimizer::Minimizer

source ·
pub struct Minimizer<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Minimizer<'a>

source

pub fn new(t: MinimizerType) -> Option<Minimizer<'a>>

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.

source

pub fn set<F: Fn(f64) -> f64 + 'a>( &mut self, f: F, x_minimum: f64, x_lower: f64, x_upper: f64 ) -> Result<(), 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.

source

pub fn set_with_values<F: Fn(f64) -> f64 + 'a>( &mut self, f: F, x_minimum: f64, f_minimum: f64, x_lower: f64, f_lower: f64, x_upper: f64, f_upper: f64 ) -> Result<(), 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).

source

pub fn name(&self) -> Option<String>

source

pub fn x_minimum(&self) -> f64

source

pub fn x_lower(&self) -> f64

source

pub fn x_upper(&self) -> f64

source

pub fn f_minimum(&self) -> f64

source

pub fn f_lower(&self) -> f64

source

pub fn f_upper(&self) -> f64

source

pub fn minimum(&self) -> f64

source

pub fn iterate(&mut self) -> Result<(), 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,

Trait Implementations§

source§

impl<'a> Drop for Minimizer<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Minimizer<'a>

§

impl<'a> !Send for Minimizer<'a>

§

impl<'a> !Sync for Minimizer<'a>

§

impl<'a> Unpin for Minimizer<'a>

§

impl<'a> !UnwindSafe for Minimizer<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.