[CLAM] FFTW vs GCC
Miguel Ramírez Jávega
mramirez at iua.upf.es
Wed Nov 5 16:26:44 PST 2003
> El codi es el següent:
> ////////////////////////////////////
> #include <fftw3.h>
>
> typedef unsigned int size;
>
> #define N 128
>
> void memset2(fftw_complex *mem, fftw_complex x, size s)
> {
> #define DOUBLE2 (sizeof(double)*2)
> unsigned int i;
> s=s/DOUBLE2;
> //for(i=0;i<s;i+=DOUBLE2)
> for(i=0;i<s;++i)
> {
> *(mem+i)[0]=x[0];
> *(mem+i)[1]=x[1];
> }
> }
>
> int main (void)
> {
> fftw_complex *in, *out;
> fftw_plan p;
>
> double relleno[2];
> relleno[0]=3;
> relleno[1]=0;
>
> in = fftw_malloc(sizeof(fftw_complex) * N*N);
> out = fftw_malloc(sizeof(fftw_complex) * N*N);
>
> memset2(in,relleno,sizeof(fftw_complex)*N*N);
> memset(out,0,sizeof(fftw_complex)*N*N);
>
> p = fftw_plan_dft_2d(N,N,in, out, FFTW_FORWARD, FFTW_ESTIMATE);
>
> fftw_execute(p); /* repeat as needed */
>
> fftw_destroy_plan(p);
>
> fftw_free(in);
> fftw_free(out);
> return 0;
> }
> /////////////////////////////////
>
BTW, are you using CLAM? Since it is a Framework for Audio and Music I
find a bit strange that you have found any use for the 2D DFT...
Miguel.
More information about the clam-users
mailing list