[][src]Struct gkquad::single::Integrator

pub struct Integrator<F: Integrand, A: Algorithm<F>> { /* fields omitted */ }
This is supported on feature="single" only.

Integration Executor

This object is useful when you want to re-use the configuration.

use std::cell::Cell;

use gkquad::Tolerance;
use gkquad::single::Integrator;

let m = Cell::new(1);
let mut result = 1.0;

let mut integrator = Integrator::auto(|x: f64| x.powi(m.get()))
    .tolerance(Tolerance::Relative(1e-7))
    .limit(100);

while m.get() <= 10 {
    result *= integrator.run(0.0..1.0).estimate().unwrap();
     
    // increment the exponent
    m.set(m.get() + 1);
}

Methods

impl<F: Integrand> Integrator<F, AUTO>[src]

pub fn auto(integrand: F) -> Integrator<F, AUTO>[src]

This is supported on feature="single" only.

impl<F: Integrand, A: Algorithm<F>> Integrator<F, A>[src]

pub fn new(integrand: F, algorithm: A) -> Integrator<F, A>[src]

This is supported on feature="single" only.

pub fn tolerance(self, t: Tolerance) -> Self[src]

This is supported on feature="single" only.

Set tolerance

pub fn limit(self, limit: usize) -> Self[src]

This is supported on feature="single" only.

Set maximum number of subintervals

pub fn points(self, pts: &[f64]) -> Self[src]

This is supported on feature="single" only.

Set singular points

pub fn get_algorithm(&self) -> &A[src]

This is supported on feature="single" only.

pub fn run<T: Into<Interval>>(&mut self, interval: T) -> IntegrationResult[src]

This is supported on feature="single" only.

Trait Implementations

impl<F: Clone + Integrand, A: Clone + Algorithm<F>> Clone for Integrator<F, A>[src]

impl<F: Debug + Integrand, A: Debug + Algorithm<F>> Debug for Integrator<F, A>[src]

impl<F: Default + Integrand, A: Default + Algorithm<F>> Default for Integrator<F, A>[src]

impl<F: PartialEq + Integrand, A: PartialEq + Algorithm<F>> PartialEq<Integrator<F, A>> for Integrator<F, A>[src]

impl<F: Integrand, A: Algorithm<F>> StructuralPartialEq for Integrator<F, A>[src]

Auto Trait Implementations

impl<F, A> RefUnwindSafe for Integrator<F, A> where
    A: RefUnwindSafe,
    F: RefUnwindSafe

impl<F, A> Send for Integrator<F, A> where
    A: Send,
    F: Send

impl<F, A> Sync for Integrator<F, A> where
    A: Sync,
    F: Sync

impl<F, A> Unpin for Integrator<F, A> where
    A: Unpin,
    F: Unpin

impl<F, A> UnwindSafe for Integrator<F, A> where
    A: UnwindSafe,
    F: 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.