diff --git a/poly/src/polynomial/univariate/dense.rs b/poly/src/polynomial/univariate/dense.rs index dca859fd0..5ea41b586 100644 --- a/poly/src/polynomial/univariate/dense.rs +++ b/poly/src/polynomial/univariate/dense.rs @@ -170,12 +170,12 @@ impl DensePolynomial { pub fn divide_by_vanishing_poly>( &self, domain: D, - ) -> Option<(DensePolynomial, DensePolynomial)> { + ) -> (DensePolynomial, DensePolynomial) { let domain_size = domain.size(); if self.coeffs.len() < domain_size { // If degree(self) < len(Domain), then the quotient is zero, and the entire polynomial is the remainder - Some((DensePolynomial::::zero(), self.clone())) + (DensePolynomial::::zero(), self.clone()) } else { // Compute the quotient // @@ -211,7 +211,7 @@ impl DensePolynomial { let quotient = DensePolynomial::::from_coefficients_vec(quotient_vec); let remainder = DensePolynomial::::from_coefficients_vec(remainder_vec); - Some((quotient, remainder)) + (quotient, remainder) } } } @@ -936,7 +936,7 @@ mod tests { let domain = GeneralEvaluationDomain::new(1 << size).unwrap(); for degree in 0..12 { let p = DensePolynomial::::rand(degree * 100, rng); - let (quotient, remainder) = p.divide_by_vanishing_poly(domain).unwrap(); + let (quotient, remainder) = p.divide_by_vanishing_poly(domain); let p_recovered = quotient.mul_by_vanishing_poly(domain) + remainder; assert_eq!(p, p_recovered); } diff --git a/poly/src/polynomial/univariate/sparse.rs b/poly/src/polynomial/univariate/sparse.rs index a69bf3fb2..313bb1f5a 100644 --- a/poly/src/polynomial/univariate/sparse.rs +++ b/poly/src/polynomial/univariate/sparse.rs @@ -538,8 +538,7 @@ mod tests { // Test interpolation works, by checking that interpolated polynomial agrees with the original on the domain let (_q, r) = (dense_poly.clone() + -sparse_evals.interpolate()) - .divide_by_vanishing_poly(domain) - .unwrap(); + .divide_by_vanishing_poly(domain); assert_eq!( r, DensePolynomial::::zero(), @@ -550,8 +549,7 @@ mod tests { // Consistency check that the dense polynomials interpolation is correct. let (_q, r) = (dense_poly.clone() + -dense_evals.interpolate()) - .divide_by_vanishing_poly(domain) - .unwrap(); + .divide_by_vanishing_poly(domain); assert_eq!( r, DensePolynomial::::zero(),