summaryrefslogtreecommitdiff
path: root/math/transforms/fftPerm.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2022-06-27 17:19:28 +0200
committermzuenni <michi.zuendorf@gmail.com>2022-06-27 17:19:28 +0200
commit5ab8a5088b729a9953b8dff1b2a985dc8fb2098b (patch)
treeed40d6936c0e9eee40ba62751cbf99ecddbaddc2 /math/transforms/fftPerm.cpp
parentadabbad9c51cf7cd3874bfde8eac1fbcf84fec10 (diff)
updated tcr
Diffstat (limited to 'math/transforms/fftPerm.cpp')
-rw-r--r--math/transforms/fftPerm.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/math/transforms/fftPerm.cpp b/math/transforms/fftPerm.cpp
new file mode 100644
index 0000000..2b6fb10
--- /dev/null
+++ b/math/transforms/fftPerm.cpp
@@ -0,0 +1,8 @@
+int perm[MAXN]; //perm[i] = j in Zeile 10
+void genPerm(int n){
+ ull mask = ~0ull << (__lg(n) - 1);
+ for (int i = 0, j = 0; i < n; i++) {
+ perm[i] = j; //if (i < j) swap(a[i], a[j]);
+ ull y = mask >> __builtin_ctz(~i);
+ j ^= y & (n - 1);
+}}