Struct GaussLegendre

Source
pub struct GaussLegendre { /* private fields */ }
Expand description

An n-point Gauss-Legendre rule on [-1, 1].

Exact for polynomials of degree up to 2n - 1; it carries no error estimate, so use it only where the integrand’s degree is known (or use integrate). Nodes come from Newton’s method on P_n started at Tricomi’s asymptotic estimates.

Implementations§

Source§

impl GaussLegendre

Source

pub const MAX_POINTS: usize = 512usize

Most points supported; beyond it the three-term recurrence’s rounding dominates and an adaptive rule is the better tool.

Source

pub fn new(n: usize) -> NumericResult<Self>

The n-point rule.

§Errors

Refuses n == 0 and n > MAX_POINTS.

Source

pub fn nodes(&self) -> &[f64]

Nodes on [-1, 1], ascending.

Source

pub fn weights(&self) -> &[f64]

Weights matching nodes; they sum to 2.

Source

pub fn apply<F: FnMut(f64) -> f64>( &self, f: F, lower: f64, upper: f64, ) -> NumericResult<f64>

Apply the rule to f on [lower, upper].

§Errors

Refuses non-finite bounds and any non-finite value of f.

Trait Implementations§

Source§

impl Clone for GaussLegendre

Source§

fn clone(&self) -> GaussLegendre

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GaussLegendre

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GaussLegendre

Source§

fn eq(&self, other: &GaussLegendre) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for GaussLegendre

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.