Function miden_core::polynom::eval
source · pub fn eval<B, E>(p: &[B], x: E) -> Ewhere
B: FieldElement,
E: FieldElement + From<B>,
Expand description
Evaluates a polynomial at a single point and returns the result.
Evaluates polynomial p
at coordinate x
using
Horner’s method.
Examples
// define polynomial: f(x) = 3 * x^2 + 2 * x + 1
let p = (1u32..4).map(BaseElement::from).collect::<Vec<_>>();
// evaluate the polynomial at point 4
let x = BaseElement::new(4);
assert_eq!(BaseElement::new(57), eval(&p, x));