summaryrefslogtreecommitdiff
path: root/content/math/transforms/xorTransform.cpp
blob: aa3db8dac7936d0cdc18b5b20b16b6608bf3adde (plain)
1
2
3
4
5
6
7
8
9
10
void fft(vector<ll>& a, bool inv = false) {
	int n = ssize(a);
	for (int s = 1; s < n; s *= 2) {
		for (int i = 0; i < n; i += 2 * s) {
			for (int j = i; j < i + s; j++) {
				ll &u = a[j], &v = a[j + s];
				tie(u, v) = pair(u + v, u - v);
	}}}
	if (inv) for (ll& x : a) x /= n;
}