@@ -24,12 +24,7 @@ namespace cp_algo::math::fft {
2424 base cur = 1 ;
2525 cvector::exec_on_roots (2 * n, std::min (n, size (a)), [&](size_t i, auto rt) {
2626 auto splt = [&](size_t i) {
27- #ifdef CP_ALGO_FFT_RANDOMIZER
2827 auto ai = ftype (i < size (a) ? (a[i] * cur).rem () : 0 );
29- cur *= factor;
30- #else
31- auto ai = ftype (i < size (a) ? a[i].rem () : 0 );
32- #endif
3328 auto rem = std::remainder (ai, split);
3429 auto quo = (ai - rem) / split;
3530 return std::pair{rem, quo};
@@ -38,6 +33,7 @@ namespace cp_algo::math::fft {
3833 auto [rani, qani] = splt (n + i);
3934 A.set (i, point (rai, rani) * rt);
4035 B.set (i, point (qai, qani) * rt);
36+ cur *= factor;
4137 });
4238 checkpoint (" dft init" );
4339 if (n) {
@@ -98,20 +94,16 @@ namespace cp_algo::math::fft {
9894 int64_t A1 = llround (real (Ci));
9995 int64_t A2 = llround (real (Bi));
10096 res[i] = A0 + A1 * split + A2 * splitsplit;
101- #ifdef CP_ALGO_FFT_RANDOMIZER
10297 res[i] *= cur;
103- #endif
10498 if (n + i >= k) {
10599 return ;
106100 }
107101 int64_t B0 = llround (imag (Ai));
108102 int64_t B1 = llround (imag (Ci));
109103 int64_t B2 = llround (imag (Bi));
110104 res[n + i] = B0 + B1 * split + B2 * splitsplit;
111- #ifdef CP_ALGO_FFT_RANDOMIZER
112105 res[n + i] *= cur * step;
113106 cur *= ifactor;
114- #endif
115107 });
116108 checkpoint (" recover mod" );
117109 }
0 commit comments