/**************************************************************************************************************** * Program to demonstrate the usage of the FFTW-library to calculate derivatives. * * * * compile with * * gcc -std=c99 -o testTrafo testTrafo.c -I(FFTW3_PATH)/include -L(FFTW_PATH)/lib -lfftw3 -lm * * * * author: Johannes Luelff * * * ****************************************************************************************************************/ #include #include #include "fftw3.h" const double PI = 3.141592635; const int N = 256; const double L = 1.0; // 0 <= x < L double init(double x) { return sin(16*PI*x/L); } int main() { int i; double field_real_in[N], field_real_out[N]; fftw_complex field_complex[N/2+1]; fftw_plan planR2C = fftw_plan_dft_r2c_1d(N, field_real_in, field_complex, FFTW_ESTIMATE); fftw_plan planC2R = fftw_plan_dft_c2r_1d(N, field_complex, field_real_out, FFTW_ESTIMATE); for(i = 0; i