File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ pub fn polynomial_benchmarks(c: &mut Criterion) {
51
51
group. bench_function ( "fast_mul big poly" , |bench| {
52
52
bench. iter ( || {
53
53
black_box ( & x_poly)
54
- . fast_multiplication :: < Degree2ExtensionField > ( black_box ( & y_poly) )
54
+ . fast_fft_multiplication :: < Degree2ExtensionField > ( black_box ( & y_poly) )
55
55
. unwrap ( )
56
56
} ) ;
57
57
} ) ;
Original file line number Diff line number Diff line change @@ -100,7 +100,11 @@ impl<E: IsField> Polynomial<FieldElement<E>> {
100
100
Ok ( scaled. scale ( & offset. inv ( ) . unwrap ( ) ) )
101
101
}
102
102
103
- pub fn fast_multiplication < F : IsFFTField + IsSubFieldOf < E > > (
103
+ /// Multiplies two polynomials using FFT.
104
+ /// It's faster than naive multiplication when the degree of the polynomials is large enough (>=2**6).
105
+ /// This works best with polynomials whose highest degree is equal to a power of 2 - 1.
106
+ /// Will return an error if the degree of the resulting polynomial is greater than 2**63.
107
+ pub fn fast_fft_multiplication < F : IsFFTField + IsSubFieldOf < E > > (
104
108
& self ,
105
109
other : & Self ,
106
110
) -> Result < Self , FFTError > {
@@ -330,7 +334,7 @@ mod tests {
330
334
331
335
#[ test]
332
336
fn test_fft_multiplication_works( poly in poly( 7 ) , other in poly( 7 ) ) {
333
- prop_assert_eq!( poly. fast_multiplication :: <F >( & other) . unwrap( ) , poly * other) ;
337
+ prop_assert_eq!( poly. fast_fft_multiplication :: <F >( & other) . unwrap( ) , poly * other) ;
334
338
}
335
339
}
336
340
@@ -430,7 +434,7 @@ mod tests {
430
434
431
435
#[ test]
432
436
fn test_fft_multiplication_works( poly in poly( 7 ) , other in poly( 7 ) ) {
433
- prop_assert_eq!( poly. fast_multiplication :: <F >( & other) . unwrap( ) , poly * other) ;
437
+ prop_assert_eq!( poly. fast_fft_multiplication :: <F >( & other) . unwrap( ) , poly * other) ;
434
438
}
435
439
}
436
440
}
You can’t perform that action at this time.
0 commit comments