We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3debf3 commit bded134Copy full SHA for bded134
crates/math/src/polynomial/mod.rs
@@ -248,8 +248,12 @@ impl<F: IsField> Polynomial<FieldElement<F>> {
248
Polynomial::new(&[FieldElement::zero()])
249
} else {
250
for i in 0..=factor.degree() {
251
- for j in 0..=self.degree() {
252
- coefficients[i + j] += &factor.coefficients[i] * &self.coefficients[j];
+ if factor.coefficients[i] != FieldElement::zero() {
+ for j in 0..=self.degree() {
253
+ if self.coefficients[j] != FieldElement::zero() {
254
+ coefficients[i + j] += &factor.coefficients[i] * &self.coefficients[j];
255
+ }
256
257
}
258
259
Polynomial::new(&coefficients)
0 commit comments