This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <int maxn> struct FFT { | |
constexpr static int lg2(int n) { return 32 - __builtin_clz(n - 1); } | |
const static int MAXN = 1 << lg2(maxn); | |
typedef complex<double> cpx; | |
int rev[MAXN]; | |
cpx rt[MAXN]; | |
FFT() { | |
rt[1] = cpx{1, 0}; | |
for (int k = 2; k < MAXN; k *= 2) { | |
cpx z[] = {1, polar(1.0, M_PI / k)}; |