Function winter_math::polynom::degree_of
source · pub fn degree_of<E>(poly: &[E]) -> usizewhere
E: FieldElement,
Expand description
Returns the degree of the provided polynomial.
If the size of the provided slice is much larger than the degree of the polynomial (i.e., a large number of leading coefficients is ZERO), this operation can be quite inefficient.
Examples
assert_eq!(0, degree_of::<BaseElement>(&[]));
assert_eq!(0, degree_of(&[BaseElement::ONE]));
assert_eq!(1, degree_of(&[BaseElement::ONE, BaseElement::new(2)]));
assert_eq!(1, degree_of(&[BaseElement::ONE, BaseElement::new(2), BaseElement::ZERO]));
assert_eq!(2, degree_of(&[BaseElement::ONE, BaseElement::new(2), BaseElement::new(3)]));
assert_eq!(
2,
degree_of(&[
BaseElement::ONE,
BaseElement::new(2),
BaseElement::new(3),
BaseElement::ZERO
])
);