pub fn poly_from_roots<E: FieldElement>(xs: &[E]) -> Vec<E>
Expand description
Returns the coefficients of polynomial given its roots.
ยงExamples
let xs = vec![1u128, 2]
.into_iter()
.map(BaseElement::new)
.collect::<Vec<_>>();
let mut expected_poly = vec![2u128, 3, 1]
.into_iter()
.map(BaseElement::new)
.collect::<Vec<_>>();
expected_poly[1] *= -BaseElement::ONE;
let poly = poly_from_roots(&xs);
assert_eq!(expected_poly, poly);