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

Function fft

contents/cooley_tukey/code/c/fft.c:9–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <fftw3.h>
8
9void fft(double complex *x, size_t n) {
10 double complex y[n];
11 memset(y, 0, sizeof(y));
12 fftw_plan p;
13
14 p = fftw_plan_dft_1d((int)n, (fftw_complex*)x, (fftw_complex*)y,
15 FFTW_FORWARD, FFTW_ESTIMATE);
16
17 fftw_execute(p);
18 fftw_destroy_plan(p);
19
20 for (size_t i = 0; i < n; ++i) {
21 x[i] = y[i] / sqrt((double)n);
22 }
23}
24
25void dft(double complex *X, const size_t N) {
26 double complex tmp[N];

Callers 2

convolve_fftFunction · 0.90
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected