pub struct PiecewiseLegendrePolyVector { /* private fields */ }Expand description
Vector of piecewise Legendre polynomials
Implementations§
Source§impl PiecewiseLegendrePolyVector
impl PiecewiseLegendrePolyVector
Sourcepub fn new(
polyvec: Vec<PiecewiseLegendrePoly>,
) -> Result<PiecewiseLegendrePolyVector, Error>
pub fn new( polyvec: Vec<PiecewiseLegendrePoly>, ) -> Result<PiecewiseLegendrePolyVector, Error>
Constructor with a vector of PiecewiseLegendrePoly
§Errors
Error::EmptyInputifpolyvecis emptyError::InvalidParameterif a polynomial has other knots or another data shape than the first: the accessors of the vector (get_knots,get_data, …) describe all of them by the first
Sourcepub fn get_polys(&self) -> &[PiecewiseLegendrePoly]
pub fn get_polys(&self) -> &[PiecewiseLegendrePoly]
Get the polynomials
Sourcepub fn from_3d_data(
data3d: Mat3<f64>,
knots: Vec<f64>,
symm: Option<Vec<i32>>,
) -> Result<PiecewiseLegendrePolyVector, Error>
pub fn from_3d_data( data3d: Mat3<f64>, knots: Vec<f64>, symm: Option<Vec<i32>>, ) -> Result<PiecewiseLegendrePolyVector, Error>
Constructor with a 3D array, knots, and symmetry vector
data3d has the shape (polyorder, nsegments, npolys); polynomial i
gets l = i and the symmetry symm[i] (0 if symm is None).
§Errors
Error::EmptyInputifdata3dhas no polynomialError::InvalidParameterifsymmdoes not have one entry per polynomial- The errors of
PiecewiseLegendrePoly::newfor the data and knots
Sourcepub fn rescale_domain(
&self,
new_knots: Vec<f64>,
new_delta_x: Option<Vec<f64>>,
new_symm: Option<Vec<i32>>,
) -> Result<PiecewiseLegendrePolyVector, Error>
pub fn rescale_domain( &self, new_knots: Vec<f64>, new_delta_x: Option<Vec<f64>>, new_symm: Option<Vec<i32>>, ) -> Result<PiecewiseLegendrePolyVector, Error>
Rescale domain for all polynomials in the vector
Creates a new PiecewiseLegendrePolyVector where each polynomial has the same data but new knots and delta_x.
§Arguments
new_knots- New knot points (same for all polynomials)new_delta_x- Optional new segment widthsnew_symm- Optional vector of new symmetry parameters (one per polynomial)
§Returns
New vector with rescaled domains
§Errors
Error::InvalidParameterifnew_symmdoes not have one entry per polynomial- The errors of
PiecewiseLegendrePoly::rescale_domain
Sourcepub fn scale_data(&self, factor: f64) -> PiecewiseLegendrePolyVector
pub fn scale_data(&self, factor: f64) -> PiecewiseLegendrePolyVector
Sourcepub fn get(&self, index: usize) -> Option<&PiecewiseLegendrePoly>
pub fn get(&self, index: usize) -> Option<&PiecewiseLegendrePoly>
Get polynomial by index (immutable)
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut PiecewiseLegendrePoly>
👎Deprecated: PiecewiseLegendrePolyVector is designed to be immutable. Use get() and create new instances for modifications.
pub fn get_mut(&mut self, index: usize) -> Option<&mut PiecewiseLegendrePoly>
PiecewiseLegendrePolyVector is designed to be immutable. Use get() and create new instances for modifications.
Get polynomial by index (mutable) - deprecated, use immutable design instead
Sourcepub fn slice_single(&self, index: usize) -> Option<PiecewiseLegendrePolyVector>
pub fn slice_single(&self, index: usize) -> Option<PiecewiseLegendrePolyVector>
Extract a single polynomial as a vector
Sourcepub fn slice_multi(
&self,
indices: &[usize],
) -> Result<PiecewiseLegendrePolyVector, Error>
pub fn slice_multi( &self, indices: &[usize], ) -> Result<PiecewiseLegendrePolyVector, Error>
Extract multiple polynomials by indices, in the order of indices
§Errors
Error::EmptyInputifindicesis emptyError::InvalidParameterfor the first index that is out of range or repeats an earlier one
Sourcepub fn evaluate_at(&self, x: f64) -> Vec<f64>
pub fn evaluate_at(&self, x: f64) -> Vec<f64>
Evaluate all polynomials at a single point
§Panics
Panics if x is outside the domain of a polynomial or NaN; see
Self::try_evaluate_at.
Sourcepub fn try_evaluate_at(&self, x: f64) -> Result<Vec<f64>, Error>
pub fn try_evaluate_at(&self, x: f64) -> Result<Vec<f64>, Error>
Self::evaluate_at returning an error instead of panicking
§Errors
Error::OutOfDomain if x is outside the domain of a polynomial
or NaN
Sourcepub fn evaluate_at_many(&self, xs: &[f64]) -> Mat<f64>
pub fn evaluate_at_many(&self, xs: &[f64]) -> Mat<f64>
Evaluate all polynomials at multiple points
The result has the shape (size, xs.len()).
§Panics
Panics if a point is outside the domain of a polynomial or NaN; see
Self::try_evaluate_at_many.
Sourcepub fn try_evaluate_at_many(&self, xs: &[f64]) -> Result<Mat<f64>, Error>
pub fn try_evaluate_at_many(&self, xs: &[f64]) -> Result<Mat<f64>, Error>
Self::evaluate_at_many returning an error instead of panicking
§Errors
Error::OutOfDomain for the first point of xs that is outside
the domain of a polynomial or NaN; every point is checked before any
is evaluated
pub fn xmin(&self) -> f64
pub fn xmax(&self) -> f64
pub fn get_knots(&self, tolerance: Option<f64>) -> Vec<f64>
pub fn get_delta_x(&self) -> Vec<f64>
pub fn get_polyorder(&self) -> usize
pub fn get_norms(&self) -> &[f64]
pub fn get_symm(&self) -> Vec<i32>
Sourcepub fn last(&self) -> &PiecewiseLegendrePoly
pub fn last(&self) -> &PiecewiseLegendrePoly
Get reference to last polynomial
C++ equivalent: u.polyvec.back()
Trait Implementations§
Source§impl Clone for PiecewiseLegendrePolyVector
impl Clone for PiecewiseLegendrePolyVector
Source§fn clone(&self) -> PiecewiseLegendrePolyVector
fn clone(&self) -> PiecewiseLegendrePolyVector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PiecewiseLegendrePolyVector
impl Debug for PiecewiseLegendrePolyVector
Auto Trait Implementations§
impl Freeze for PiecewiseLegendrePolyVector
impl RefUnwindSafe for PiecewiseLegendrePolyVector
impl Send for PiecewiseLegendrePolyVector
impl Sync for PiecewiseLegendrePolyVector
impl Unpin for PiecewiseLegendrePolyVector
impl UnsafeUnpin for PiecewiseLegendrePolyVector
impl UnwindSafe for PiecewiseLegendrePolyVector
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
impl<T, U> Imply<T> for U
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 moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
impl<T> MaybeSync for Twhere
T: Sync,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.