../../.cargo/katex-header.html

Function winter_math::polynom::eval_many

source ·
pub fn eval_many<B, E>(p: &[B], xs: &[E]) -> Vec<E>
where B: FieldElement, E: FieldElement + From<B>,
Expand description

Evaluates a polynomial at multiple points and returns a vector of results.

Evaluates polynomial p at all coordinates in xs slice by repeatedly invoking polynom::eval() function.

§Examples

// define polynomial: f(x) = 3 * x^2 + 2 * x + 1
let p = (1_u32..4).map(BaseElement::from).collect::<Vec<_>>();
let xs = (3_u32..6).map(BaseElement::from).collect::<Vec<_>>();

let expected = xs.iter().map(|x| eval(&p, *x)).collect::<Vec<_>>();
assert_eq!(expected, eval_many(&p, &xs));