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

Function winter_math::polynom::remove_leading_zeros

source ·
pub fn remove_leading_zeros<E>(values: &[E]) -> Vec<E>
where E: FieldElement,
Expand description

Returns a polynomial with all leading ZERO coefficients removed.

§Examples

let a = vec![1u128, 2, 3, 4, 5, 6, 0, 0]
    .into_iter()
    .map(BaseElement::new)
    .collect::<Vec<_>>();
let b = remove_leading_zeros(&a);
assert_eq!(6, b.len());
assert_eq!(a[..6], b);

let a = vec![0u128, 0, 0, 0]
    .into_iter()
    .map(BaseElement::new)
    .collect::<Vec<_>>();
let b = remove_leading_zeros(&a);
assert_eq!(0, b.len());