You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(fft): add fast multiplication
* chore: add fast_mul benchmark
* impl suggestion
* chore: impl suggestion
* chore: add fast_mul benchmark
* feat(fft): fast division
* refacto: proper error handling
* refacto: rename inversion function
* test: add tests for fast division helper functions
* doc: explain where fast division is taken from
---------
Co-authored-by: Diego K <[email protected]>
let two = Self::new(&[FieldElement::<F>::one() + FieldElement::one()]);
172
+
while current_precision < k {
173
+
current_precision *= 2;
174
+
let temp = self
175
+
.fast_fft_multiplication::<F>(&q)?
176
+
.truncate(current_precision);
177
+
let correction = &two - temp;
178
+
q = q
179
+
.fast_fft_multiplication::<F>(&correction)?
180
+
.truncate(current_precision);
181
+
}
182
+
183
+
// Final truncation to desired degree k
184
+
Ok(q.truncate(k))
185
+
}
118
186
}
119
187
120
188
pubfncompose_fft<F,E>(
@@ -273,6 +341,11 @@ mod tests {
273
341
vec
274
342
}
275
343
}
344
+
prop_compose!{
345
+
fn non_empty_field_vec(max_exp:u8)(vec in collection::vec(field_element(),1 << max_exp)) -> Vec<FE> {
346
+
vec
347
+
}
348
+
}
276
349
prop_compose!{
277
350
fn non_power_of_two_sized_field_vec(max_exp:u8)(vec in collection::vec(field_element(),2..1<<max_exp).prop_filter("Avoid polynomials of size power of two", |vec| !vec.len().is_power_of_two())) -> Vec<FE> {
278
351
vec
@@ -283,6 +356,11 @@ mod tests {
283
356
Polynomial::new(&coeffs)
284
357
}
285
358
}
359
+
prop_compose!{
360
+
fn non_zero_poly(max_exp:u8)(coeffs in non_empty_field_vec(max_exp)) -> Polynomial<FE> {
361
+
Polynomial::new(&coeffs)
362
+
}
363
+
}
286
364
prop_compose!{
287
365
fn poly_with_non_power_of_two_coeffs(max_exp:u8)(coeffs in non_power_of_two_sized_field_vec(max_exp)) -> Polynomial<FE> {
288
366
Polynomial::new(&coeffs)
@@ -336,6 +414,17 @@ mod tests {
336
414
fn test_fft_multiplication_works(poly in poly(7), other in poly(7)){
fn non_empty_field_vec(max_exp:u8)(vec in collection::vec(field_element(),1 << max_exp)) -> Vec<FE> {
465
+
vec
466
+
}
467
+
}
374
468
prop_compose!{
375
469
fn non_power_of_two_sized_field_vec(max_exp:u8)(vec in collection::vec(field_element(),2..1<<max_exp).prop_filter("Avoid polynomials of size power of two", |vec| !vec.len().is_power_of_two())) -> Vec<FE> {
376
470
vec
@@ -381,6 +475,11 @@ mod tests {
381
475
Polynomial::new(&coeffs)
382
476
}
383
477
}
478
+
prop_compose!{
479
+
fn non_zero_poly(max_exp:u8)(coeffs in non_empty_field_vec(max_exp)) -> Polynomial<FE> {
480
+
Polynomial::new(&coeffs)
481
+
}
482
+
}
384
483
prop_compose!{
385
484
fn poly_with_non_power_of_two_coeffs(max_exp:u8)(coeffs in non_power_of_two_sized_field_vec(max_exp)) -> Polynomial<FE> {
386
485
Polynomial::new(&coeffs)
@@ -436,6 +535,17 @@ mod tests {
436
535
fn test_fft_multiplication_works(poly in poly(7), other in poly(7)){
0 commit comments