diff --git a/src/domain.rs b/src/domain.rs index d9327dd..c3d011c 100644 --- a/src/domain.rs +++ b/src/domain.rs @@ -98,14 +98,14 @@ impl> EvaluationDomain { } // this one does expect coefficients to be smaller than `num_roots_of_unity/2` as we expect multiplication - pub fn from_coeffs_for_multiplication(mut coeffs: Vec, expected_power: usize) -> Result, SynthesisError> + pub fn from_coeffs_into_sized(mut coeffs: Vec, size: usize) -> Result, SynthesisError> { use ff::PrimeField; // Compute the size of our evaluation domain - assert!(expected_power >= coeffs.len()); + assert!(size >= coeffs.len()); - let coeffs_len = expected_power; + let coeffs_len = size; // m is a size of domain where Z polynomial does NOT vanish // in normal domain Z is in a form of (X-1)(X-2)...(X-N) diff --git a/src/sonic/util.rs b/src/sonic/util.rs index c087b5e..70982d2 100644 --- a/src/sonic/util.rs +++ b/src/sonic/util.rs @@ -266,7 +266,7 @@ fn laurent_division() { assert_eq!(lhs, rhs); } -pub fn multiply_polynomials(mut a: Vec, mut b: Vec) -> Vec { +pub fn multiply_polynomials(a: Vec, b: Vec) -> Vec { let result_len = a.len() + b.len() - 1; use crate::multicore::Worker; @@ -274,10 +274,10 @@ pub fn multiply_polynomials(mut a: Vec, mut b: Vec) -> let worker = Worker::new(); let scalars_a: Vec> = a.into_iter().map(|e| Scalar::(e)).collect(); - let mut domain_a = EvaluationDomain::from_coeffs_for_multiplication(scalars_a, result_len).unwrap(); + let mut domain_a = EvaluationDomain::from_coeffs_into_sized(scalars_a, result_len).unwrap(); let scalars_b: Vec> = b.into_iter().map(|e| Scalar::(e)).collect(); - let mut domain_b = EvaluationDomain::from_coeffs_for_multiplication(scalars_b, result_len).unwrap(); + let mut domain_b = EvaluationDomain::from_coeffs_into_sized(scalars_b, result_len).unwrap(); domain_a.fft(&worker); domain_b.fft(&worker);