Struct sparse_interp::EvalTrait [−][src]
A trait struct used for multi-point evaluation of polynomials.
Typically, T
will be a type which implements PolyTraits
and
U
will be the type of evaluation point. If the combination of T
and U
is meaningful, then EvalTrait<T,U>
should implement
EvalTypes
; this indicates that polynomials under trait T
can be evaluated at points of type U
.
The purpose of this is to allow a polynomial with coefficients of one type (say, integers) to be evaluated at a point with another type (say, complex numbers, or integers modulo a prime).
type Eval = EvalTrait<ClassicalTraits<i32>, f32>; let coeffs = [1, 0, -2]; let pts = [0.5, -1.5]; let info = Eval::prep(pts.iter().copied()); let mut result = Vec::new(); Eval::post(&mut result, &coeffs, &info); assert_eq!(result, vec![0.5, -3.5]);
This is essentially a work-around for a problem better solved by GATs. (At the time of this writing, GAT is merged in nightly rust but not stable.)
Trait Implementations
impl<T: Debug + ?Sized, U: Debug> Debug for EvalTrait<T, U>
[src]
impl<C, U> EvalTypes for EvalTrait<ClassicalTraits<C>, U> where
C: Clone,
U: Clone + Zero + MulAssign + AddAssign,
DefConv<C, U>: OneWay<Source = C, Dest = U>,
[src]
C: Clone,
U: Clone + Zero + MulAssign + AddAssign,
DefConv<C, U>: OneWay<Source = C, Dest = U>,
type Coeff = C
Coefficient type of the polynomial being evaluated.
type Eval = U
Type of the evaluation point(s) and the output(s) of the polynomial evaluation.
type EvalInfo = Vec<U>
Opaque type to hold pre-processing results.
fn prep(pts: impl Iterator<Item = Self::Eval>) -> Self::EvalInfo
[src]
fn post(
out: &mut impl Extend<Self::Eval>,
coeffs: &[Self::Coeff],
info: &Self::EvalInfo
) -> Result<()>
[src]
out: &mut impl Extend<Self::Eval>,
coeffs: &[Self::Coeff],
info: &Self::EvalInfo
) -> Result<()>
Auto Trait Implementations
impl<T: ?Sized, U> RefUnwindSafe for EvalTrait<T, U> where
T: RefUnwindSafe,
U: RefUnwindSafe,
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T: ?Sized, U> Send for EvalTrait<T, U> where
T: Send,
U: Send,
T: Send,
U: Send,
impl<T: ?Sized, U> Sync for EvalTrait<T, U> where
T: Sync,
U: Sync,
T: Sync,
U: Sync,
impl<T: ?Sized, U> Unpin for EvalTrait<T, U> where
T: Unpin,
U: Unpin,
T: Unpin,
U: Unpin,
impl<T: ?Sized, U> UnwindSafe for EvalTrait<T, U> where
T: UnwindSafe,
U: UnwindSafe,
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,