Struct sparse_interp::EvalTrait[][src]

pub struct EvalTrait<T: ?Sized, U>(_, _);

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]

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.

Auto Trait Implementations

impl<T: ?Sized, U> RefUnwindSafe for EvalTrait<T, U> where
    T: RefUnwindSafe,
    U: RefUnwindSafe

impl<T: ?Sized, U> Send for EvalTrait<T, U> where
    T: Send,
    U: Send

impl<T: ?Sized, U> Sync for EvalTrait<T, U> where
    T: Sync,
    U: Sync

impl<T: ?Sized, U> Unpin for EvalTrait<T, U> where
    T: Unpin,
    U: Unpin

impl<T: ?Sized, U> UnwindSafe for EvalTrait<T, U> where
    T: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.