[][src]Struct peroxide::numerical::root::RootFinder

pub struct RootFinder<F: Fn(T) -> T, T: AD> {
    pub curr: RootState,
    // some fields omitted
}

Structure for Root finding

  • Caution: T $\geq$ AD1

Fields

curr: RootState

Implementations

impl<F: Fn(T) -> T, T: AD> RootFinder<F, T>[src]

pub fn new(init: RootState, method: RootFind, f: F) -> Result<Self, RootError>[src]

Create RootFinder

Default Options

  • Times: 100
  • Tolerance: 1e-10

Usage

extern crate peroxide;
use peroxide::fuga::*;

fn main() -> Result<(), RootError> {
    let init = RootState::I(1f64, 3f64);
    let mut a = RootFinder::<_, AD1>::new(init, Bisection, f)?;
    let x = a.find_root()?;
    x.print();
    Ok(())
}

fn f<T: AD>(x: T) -> T {
    x.powi(2) - 4f64
}

pub fn f(&self, x: T) -> T[src]

pub fn condition_number(&self) -> f64[src]

Condition number

pub fn set_times(&mut self, times: usize) -> &mut Self[src]

Set max iteration times

pub fn set_tol(&mut self, tol: f64) -> &mut Self[src]

Set tolerance

pub fn update(&mut self)[src]

Update RootFinder

pub fn find_root(&mut self) -> Result<f64, RootError>[src]

Find Root

Trait Implementations

impl<F: Clone + Fn(T) -> T, T: Clone + AD> Clone for RootFinder<F, T>[src]

impl<F: Debug + Fn(T) -> T, T: Debug + AD> Debug for RootFinder<F, T>[src]

Auto Trait Implementations

impl<F, T> RefUnwindSafe for RootFinder<F, T> where
    F: RefUnwindSafe,
    T: RefUnwindSafe

impl<F, T> Send for RootFinder<F, T> where
    F: Send,
    T: Send

impl<F, T> Sync for RootFinder<F, T> where
    F: Sync,
    T: Sync

impl<F, T> Unpin for RootFinder<F, T> where
    T: Unpin

impl<F, T> UnwindSafe for RootFinder<F, T> where
    F: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,