pub struct PiecewiseLegendrePoly {
pub polyorder: usize,
pub xmin: f64,
pub xmax: f64,
pub knots: Vec<f64>,
pub delta_x: Vec<f64>,
pub data: DTensor<f64, 2>,
pub symm: i32,
pub l: i32,
pub xm: Vec<f64>,
pub inv_xs: Vec<f64>,
pub norms: Vec<f64>,
}Expand description
A single piecewise Legendre polynomial
Fields§
§polyorder: usizePolynomial order (degree of Legendre polynomials in each segment)
xmin: f64Minimum x value of the domain
xmax: f64Maximum x value of the domain
knots: Vec<f64>Knot points defining the segments
delta_x: Vec<f64>Segment widths (for numerical stability)
data: DTensor<f64, 2>Coefficient matrix: [degree][segment_index]
symm: i32Symmetry parameter
l: i32Polynomial parameter (used in power moments calculation)
xm: Vec<f64>Segment midpoints
inv_xs: Vec<f64>Inverse segment widths
norms: Vec<f64>Normalization factors
Implementations§
Source§impl PiecewiseLegendrePoly
impl PiecewiseLegendrePoly
Sourcepub fn new(
data: DTensor<f64, 2>,
knots: Vec<f64>,
l: i32,
delta_x: Option<Vec<f64>>,
symm: i32,
) -> Self
pub fn new( data: DTensor<f64, 2>, knots: Vec<f64>, l: i32, delta_x: Option<Vec<f64>>, symm: i32, ) -> Self
Create a new PiecewiseLegendrePoly from data and knots
Sourcepub fn with_data(&self, new_data: DTensor<f64, 2>) -> Self
pub fn with_data(&self, new_data: DTensor<f64, 2>) -> Self
Create a new PiecewiseLegendrePoly with new data but same structure
Sourcepub fn with_data_and_symmetry(
&self,
new_data: DTensor<f64, 2>,
new_symm: i32,
) -> Self
pub fn with_data_and_symmetry( &self, new_data: DTensor<f64, 2>, new_symm: i32, ) -> Self
Create a new PiecewiseLegendrePoly with new data and symmetry
Sourcepub fn rescale_domain(
&self,
new_knots: Vec<f64>,
new_delta_x: Option<Vec<f64>>,
new_symm: Option<i32>,
) -> Self
pub fn rescale_domain( &self, new_knots: Vec<f64>, new_delta_x: Option<Vec<f64>>, new_symm: Option<i32>, ) -> Self
Rescale domain: create a new polynomial with the same data but different knots
This is useful for transforming from one domain to another, e.g., from x ∈ [-1, 1] to τ ∈ [0, β].
§Arguments
new_knots- New knot pointsnew_delta_x- Optional new segment widths (computed from knots if None)new_symm- Optional new symmetry parameter (keeps old if None)
§Returns
New polynomial with rescaled domain
Sourcepub fn scale_data(&self, factor: f64) -> Self
pub fn scale_data(&self, factor: f64) -> Self
Sourcepub fn evaluate_many(&self, xs: &[f64]) -> Vec<f64>
pub fn evaluate_many(&self, xs: &[f64]) -> Vec<f64>
Evaluate the polynomial at multiple points
Sourcepub fn evaluate_legendre_polynomial(&self, x: f64, coeffs: &[f64]) -> f64
pub fn evaluate_legendre_polynomial(&self, x: f64, coeffs: &[f64]) -> f64
Evaluate Legendre polynomial using recurrence relation
pub fn get_xmin(&self) -> f64
pub fn get_xmax(&self) -> f64
pub fn get_l(&self) -> i32
pub fn get_domain(&self) -> (f64, f64)
pub fn get_knots(&self) -> &[f64]
pub fn get_delta_x(&self) -> &[f64]
pub fn get_symm(&self) -> i32
pub fn get_data(&self) -> &DTensor<f64, 2>
pub fn get_norms(&self) -> &[f64]
pub fn get_polyorder(&self) -> usize
Trait Implementations§
Source§impl Clone for PiecewiseLegendrePoly
impl Clone for PiecewiseLegendrePoly
Source§fn clone(&self) -> PiecewiseLegendrePoly
fn clone(&self) -> PiecewiseLegendrePoly
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PiecewiseLegendrePoly
impl RefUnwindSafe for PiecewiseLegendrePoly
impl Send for PiecewiseLegendrePoly
impl Sync for PiecewiseLegendrePoly
impl Unpin for PiecewiseLegendrePoly
impl UnwindSafe for PiecewiseLegendrePoly
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.