RootFSolver

Struct RootFSolver 

Source
pub struct RootFSolver<'a> { /* private fields */ }
Expand description

This is a workspace for finding roots using methods which do not require derivatives.

Implementations§

Source§

impl<'a> RootFSolver<'a>

Source

pub fn new(t: RootFSolverType) -> Option<RootFSolver<'a>>

This function returns a pointer to a newly allocated instance of a solver of type T.

If there is insufficient memory to create the solver then the function returns a null pointer and the error handler is invoked with an error code of Value::NoMemory.

Source

pub fn set<F: Fn(f64) -> f64 + 'a>( &mut self, f: F, x_lower: f64, x_upper: f64, ) -> Result<(), Value>

This function initializes, or reinitializes, an existing solver s to use the function f and the initial search interval [x lower, x upper].

Source

pub fn iterate(&mut self) -> Result<(), Value>

The following function drives the iteration of each algorithm. Each function performs one iteration to update the state of any solver of the corresponding type. The same func- tion works for all solvers so that different methods can be substituted at runtime without modifications to the code.

This function performs a single iteration of the solver s. If the iteration encounters an unexpected problem then an error code will be returned.

The solver maintains a current best estimate of the root at all times. The bracketing solvers also keep track of the current best interval bounding the root.

Source

pub fn name(&self) -> String

Returns the solver type name.

Source

pub fn root(&self) -> f64

This function returns the current estimate of the root for the solver s.

Source

pub fn x_lower(&self) -> f64

These functions return the current bracketing interval for the solver s.

Source

pub fn x_upper(&self) -> f64

These functions return the current bracketing interval for the solver s.

Trait Implementations§

Source§

impl<'a> Drop for RootFSolver<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for RootFSolver<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for RootFSolver<'a>

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.