MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / cooley_tukey

Function cooley_tukey

contents/cooley_tukey/code/c/fft.c:37–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void cooley_tukey(double complex *X, const size_t N) {
38 if (N >= 2) {
39 double complex tmp [N / 2];
40 for (size_t i = 0; i < N / 2; ++i) {
41 tmp[i] = X[2*i + 1];
42 X[i] = X[2*i];
43 }
44 for (size_t i = 0; i < N / 2; ++i) {
45 X[i + N / 2] = tmp[i];
46 }
47
48 cooley_tukey(X, N / 2);
49 cooley_tukey(X + N / 2, N / 2);
50
51 for (size_t i = 0; i < N / 2; ++i) {
52 X[i + N / 2] = X[i] - cexp(-2.0 * I * M_PI * (double)i / (double)N) * X[i + N / 2];
53 X[i] -= (X[i + N / 2]-X[i]);
54 }
55 }
56}
57
58void bit_reverse(double complex *X, size_t N) {
59 for (size_t i = 0; i < N; ++i) {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected