`pub struct BrentOpt<F> { /* private fields */ }`

## Expand description

## §Brent’s method

A minimization algorithm combining parabolic interpolation and the golden-section method. It has the reliability of the golden-section method, but can be faster thanks to the parabolic interpolation steps.

### §Requirements on the optimization problem

The optimization problem is required to implement `CostFunction`

.

### §Reference

“An algorithm with guaranteed convergence for finding a minimum of
a function of one variable”, *Algorithms for minimization without
derivatives*, Richard P. Brent, 1973, Prentice-Hall.

## Implementations§

source§### impl<F: ArgminFloat> BrentOpt<F>

### impl<F: ArgminFloat> BrentOpt<F>

source#### pub fn new(min: F, max: F) -> Self

#### pub fn new(min: F, max: F) -> Self

Constructor

The values `min`

and `max`

must bracket the minimum of the function.

source#### pub fn set_tolerance(self, eps: F, t: F) -> Self

#### pub fn set_tolerance(self, eps: F, t: F) -> Self

Set the tolerance to the value required.

The algorithm will return an approximation `x`

of a local
minimum of the function, with an accuracy smaller than `3 tol`

,
where `tol = eps*abs(x) + t`

.
It is useless to set `eps`

to less than the square root of the
machine precision (`F::epsilon().sqrt()`

), which is its default
value. The default value of `t`

is `1e-5`

.

## Trait Implementations§

source§### impl<'de, F> Deserialize<'de> for BrentOpt<F>where
F: Deserialize<'de>,

### impl<'de, F> Deserialize<'de> for BrentOpt<F>where
F: Deserialize<'de>,

source§#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,

#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,

source§### impl<O, F> Solver<O, IterState<F, (), (), (), (), F>> for BrentOpt<F>where
O: CostFunction<Param = F, Output = F>,
F: ArgminFloat,

### impl<O, F> Solver<O, IterState<F, (), (), (), (), F>> for BrentOpt<F>where
O: CostFunction<Param = F, Output = F>,
F: ArgminFloat,

source§#### fn init(
&mut self,
problem: &mut Problem<O>,
state: IterState<F, (), (), (), (), F>,
) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>

#### fn init( &mut self, problem: &mut Problem<O>, state: IterState<F, (), (), (), (), F>, ) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>

source§#### fn next_iter(
&mut self,
problem: &mut Problem<O>,
state: IterState<F, (), (), (), (), F>,
) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>

#### fn next_iter( &mut self, problem: &mut Problem<O>, state: IterState<F, (), (), (), (), F>, ) -> Result<(IterState<F, (), (), (), (), F>, Option<KV>), Error>

`state`

and optionally a `KV`

which holds key-value pairs used in
Observers.source§#### fn terminate_internal(&mut self, state: &I) -> TerminationStatus

#### fn terminate_internal(&mut self, state: &I) -> TerminationStatus

source§#### fn terminate(&mut self, _state: &I) -> TerminationStatus

#### fn terminate(&mut self, _state: &I) -> TerminationStatus

`terminate_internal`

. Read more## Auto Trait Implementations§

### impl<F> Freeze for BrentOpt<F>where
F: Freeze,

### impl<F> RefUnwindSafe for BrentOpt<F>where
F: RefUnwindSafe,

### impl<F> Send for BrentOpt<F>where
F: Send,

### impl<F> Sync for BrentOpt<F>where
F: Sync,

### impl<F> Unpin for BrentOpt<F>where
F: Unpin,

### impl<F> UnwindSafe for BrentOpt<F>where
F: UnwindSafe,

## Blanket Implementations§

source§### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

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

source§#### fn borrow_mut(&mut self) -> &mut T

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

§### impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,

### impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,

§#### fn to_subset(&self) -> Option<SS>

#### fn to_subset(&self) -> Option<SS>

`self`

from the equivalent element of its
superset. Read more§#### fn is_in_subset(&self) -> bool

#### fn is_in_subset(&self) -> bool

`self`

is actually part of its subset `T`

(and can be converted to it).§#### fn to_subset_unchecked(&self) -> SS

#### fn to_subset_unchecked(&self) -> SS

`self.to_subset`

but without any property checks. Always succeeds.§#### fn from_subset(element: &SS) -> SP

#### fn from_subset(element: &SS) -> SP

`self`

to the equivalent element of its superset.