pub struct EvalTrait<T: ?Sized, U>(/* private fields */);
Expand description
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§
Auto Trait Implementations§
impl<T, U> Freeze for EvalTrait<T, U>where
T: ?Sized,
impl<T, U> RefUnwindSafe for EvalTrait<T, U>
impl<T, U> Send for EvalTrait<T, U>
impl<T, U> Sync for EvalTrait<T, U>
impl<T, U> Unpin for EvalTrait<T, U>
impl<T, U> UnwindSafe for EvalTrait<T, U>
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
Mutably borrows from an owned value. Read more