Several operations leave high order zeros in the vector, which should be removed. For example, the following would occur in a subtraction:
let a = Polynomial::from(vec![1, 2, 3]);
let b = Polynomial::from(vec![0, 0, 3]);
let c = a - b; // c now has an unnecessary 0 at idx 2: [1, 2, 0]
assert_eq!(c[2], 0);
These zeros can stack up as more operations are performed. It would be preferable to trim unnecessary zeros, however this may incur a significant runtime cost, as there is no easy way to detect zeros.
Several operations leave high order zeros in the vector, which should be removed. For example, the following would occur in a subtraction:
These zeros can stack up as more operations are performed. It would be preferable to trim unnecessary zeros, however this may incur a significant runtime cost, as there is no easy way to detect zeros.