fftw - Problem with FFTW2 routine in C -
i'm working fftw2 (fastest fourier transform in west) library, , after writing successful routine in fortran, moving on c. however, i'm having trouble data assigning when try input data transform (ie, values of sin(x)). currently, code is:
#include <stdio.h> #include <fftw.h> #include <math.h> #include <complex.h> void compute_fft(){ int i; const int n[8]; fftw_complex in[8]; fftwnd_plan p; in[0]->re = 0; in[1]->re = (sqrt(2)/2); in[2]->re = 1; in[3]->re = (sqrt(2)/2); in[4]->re = 0; in[5]->re = -(sqrt(2)/2); in[6]->re = -1; in[7]->re = -(sqrt(2)/2); for(i = 0; < 8; i++){ (in[i])->im = 0; } p = fftwnd_create_plan(8, n, fftw_forward, fftw_esimate | fftw_in_place); fftwnd_one(p, &in[0], null); fftwnd_destroy_plan(p); printf("sin\n"); for(i = 0; < 8; i++){ printf("%d\n", n[i]); } }
i've been using http://fftw.org/fftw2_doc/ link documentation/tutorial purposes, , error "invalid type argument of a->a (have afftw_complexa)", , 'a' characters on either side of -> , fftw_complex have carats above them. i'm using same pattern worked when wrote in fortran, , seem following tutorial, it's assignment here messing syntax on. record, compiler using nvcc, if makes difference (i tried gcc). if here has every used fftw2 in c before, correct mistake? thank you!
it might because of array "in" array of fftw_complex instead of using in[0]->re = 0 should use in[0].re = 0. unless fftw_complex again typedefined array.
fftw_complex in[8]; in[0].re = 0; in[1].re = (sqrt(2)/2); in[2].re = 1; in[3].re = (sqrt(2)/2); in[4].re = 0; in[5].re = -(sqrt(2)/2); in[6].re = -1; in[7].re = -(sqrt(2)/2);
Comments
Post a Comment