PiecewiseLegendrePolyVector

Struct PiecewiseLegendrePolyVector 

Source
pub struct PiecewiseLegendrePolyVector {
    pub polyvec: Vec<PiecewiseLegendrePoly>,
}
Expand description

Vector of piecewise Legendre polynomials

Fields§

§polyvec: Vec<PiecewiseLegendrePoly>

Individual polynomials

Implementations§

Source§

impl PiecewiseLegendrePolyVector

Source

pub fn new(polyvec: Vec<PiecewiseLegendrePoly>) -> Self

Constructor with a vector of PiecewiseLegendrePoly

§Panics

Panics if the input vector is empty, as empty PiecewiseLegendrePolyVector is not meaningful

Source

pub fn get_polys(&self) -> &[PiecewiseLegendrePoly]

Get the polynomials

Source

pub fn from_3d_data( data3d: DTensor<f64, 3>, knots: Vec<f64>, symm: Option<Vec<i32>>, ) -> Self

Constructor with a 3D array, knots, and symmetry vector

Source

pub fn size(&self) -> usize

Get the size of the vector

Source

pub fn rescale_domain( &self, new_knots: Vec<f64>, new_delta_x: Option<Vec<f64>>, new_symm: Option<Vec<i32>>, ) -> Self

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 widths
  • new_symm - Optional vector of new symmetry parameters (one per polynomial)
§Returns

New vector with rescaled domains

Source

pub fn scale_data(&self, factor: f64) -> Self

Scale all data values by a constant factor

Multiplies the data of all polynomials by the same factor.

§Arguments
  • factor - Scaling factor to multiply all data by
§Returns

New vector with scaled data

Source

pub fn get(&self, index: usize) -> Option<&PiecewiseLegendrePoly>

Get polynomial by index (immutable)

Source

pub 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.

Get polynomial by index (mutable) - deprecated, use immutable design instead

Source

pub fn slice_single(&self, index: usize) -> Option<Self>

Extract a single polynomial as a vector

Source

pub fn slice_multi(&self, indices: &[usize]) -> Self

Extract multiple polynomials by indices

Source

pub fn evaluate_at(&self, x: f64) -> Vec<f64>

Evaluate all polynomials at a single point

Source

pub fn evaluate_at_many(&self, xs: &[f64]) -> DTensor<f64, 2>

Evaluate all polynomials at multiple points

Source

pub fn xmin(&self) -> f64

Source

pub fn xmax(&self) -> f64

Source

pub fn get_knots(&self, tolerance: Option<f64>) -> Vec<f64>

Source

pub fn get_delta_x(&self) -> Vec<f64>

Source

pub fn get_polyorder(&self) -> usize

Source

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

Source

pub fn get_symm(&self) -> Vec<i32>

Source

pub fn get_data(&self) -> DTensor<f64, 3>

Get data as 3D tensor: [segment][degree][polynomial]

Source

pub fn roots(&self, tolerance: Option<f64>) -> Vec<f64>

Find roots of all polynomials

Source

pub fn last(&self) -> &PiecewiseLegendrePoly

Get reference to last polynomial

C++ equivalent: u.polyvec.back()

Source

pub fn nroots(&self, tolerance: Option<f64>) -> usize

Get the number of roots

Trait Implementations§

Source§

impl Clone for PiecewiseLegendrePolyVector

Source§

fn clone(&self) -> PiecewiseLegendrePolyVector

Returns a duplicate 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 PiecewiseLegendrePolyVector

Source§

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

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

impl Index<usize> for PiecewiseLegendrePolyVector

Source§

type Output = PiecewiseLegendrePoly

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

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> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

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> IntoCloned<T> for T

Source§

fn clone_to(self, target: &mut T)

Moves an existing object or clones from a reference to the target object.
Source§

fn into_cloned(self) -> T

Returns an existing object or a new clone from a reference.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V