pub struct Rule<T> {
pub x: Vec<T>,
pub w: Vec<T>,
pub x_forward: Vec<T>,
pub x_backward: Vec<T>,
pub a: T,
pub b: T,
}Expand description
Quadrature rule for numerical integration.
Represents an approximation of an integral by a weighted sum over discrete points.
The rule contains quadrature points x, weights w, and auxiliary arrays
x_forward and x_backward for efficient computation.
Fields§
§x: Vec<T>Quadrature points
w: Vec<T>Quadrature weights
x_forward: Vec<T>Distance from left endpoint: x - a
x_backward: Vec<T>Distance from right endpoint: b - x
a: TLeft endpoint of integration interval
b: TRight endpoint of integration interval
Implementations§
Source§impl<T> Rule<T>where
T: CustomNumeric,
impl<T> Rule<T>where
T: CustomNumeric,
Sourcepub fn from_vectors(x: Vec<T>, w: Vec<T>, a: T, b: T) -> Self
pub fn from_vectors(x: Vec<T>, w: Vec<T>, a: T, b: T) -> Self
Create a new quadrature rule from vectors.
Sourcepub fn reseat(&self, a: T, b: T) -> Self
pub fn reseat(&self, a: T, b: T) -> Self
Reseat the rule to a new interval [a, b].
Scales and translates the quadrature points and weights to the new interval.
Source§impl<T> Rule<T>where
T: CustomNumeric,
CustomNumeric-based implementation for f64 and Df64 support
impl<T> Rule<T>where
T: CustomNumeric,
CustomNumeric-based implementation for f64 and Df64 support
Sourcepub fn new_custom(x: Vec<T>, w: Vec<T>, a: T, b: T) -> Self
pub fn new_custom(x: Vec<T>, w: Vec<T>, a: T, b: T) -> Self
Create a new quadrature rule from points and weights (CustomNumeric version).
Sourcepub fn from_vectors_custom(x: Vec<T>, w: Vec<T>, a: T, b: T) -> Self
pub fn from_vectors_custom(x: Vec<T>, w: Vec<T>, a: T, b: T) -> Self
Create a new quadrature rule from vectors (CustomNumeric version).
Sourcepub fn reseat_custom(&self, a: T, b: T) -> Self
pub fn reseat_custom(&self, a: T, b: T) -> Self
Reseat the rule to a new interval [a, b] (CustomNumeric version).
Sourcepub fn scale_custom(&self, factor: T) -> Self
pub fn scale_custom(&self, factor: T) -> Self
Scale the weights by a factor (CustomNumeric version).
Sourcepub fn validate_custom(&self) -> bool
pub fn validate_custom(&self) -> bool
Validate the rule for consistency (CustomNumeric version).
Source§impl Rule<Df64>
Df64-specific implementation without ScalarOperand requirement
impl Rule<Df64>
Df64-specific implementation without ScalarOperand requirement
Sourcepub fn new_twofloat(x: Vec<Df64>, w: Vec<Df64>, a: Df64, b: Df64) -> Self
pub fn new_twofloat(x: Vec<Df64>, w: Vec<Df64>, a: Df64, b: Df64) -> Self
Create a new quadrature rule from points and weights (Df64 version).
Sourcepub fn from_vectors_twofloat(
x: Vec<Df64>,
w: Vec<Df64>,
a: Df64,
b: Df64,
) -> Self
pub fn from_vectors_twofloat( x: Vec<Df64>, w: Vec<Df64>, a: Df64, b: Df64, ) -> Self
Create a new quadrature rule from vectors (Df64 version).
Sourcepub fn reseat_twofloat(&self, a: Df64, b: Df64) -> Self
pub fn reseat_twofloat(&self, a: Df64, b: Df64) -> Self
Reseat the rule to a new interval [a, b] (Df64 version).
Sourcepub fn scale_twofloat(&self, factor: Df64) -> Self
pub fn scale_twofloat(&self, factor: Df64) -> Self
Scale the weights by a factor (Df64 version).
Sourcepub fn validate_twofloat(&self) -> bool
pub fn validate_twofloat(&self) -> bool
Validate the rule for consistency (Df64 version).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Rule<T>where
T: Freeze,
impl<T> RefUnwindSafe for Rule<T>where
T: RefUnwindSafe,
impl<T> Send for Rule<T>where
T: Send,
impl<T> Sync for Rule<T>where
T: Sync,
impl<T> Unpin for Rule<T>where
T: Unpin,
impl<T> UnwindSafe for Rule<T>where
T: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoCloned<T> for T
impl<T> IntoCloned<T> for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.