 The master, I want to ask you, is that I now study cuda Fourier transform, I wanted to ask you is what I refer to the official website of the article, so I gave some program code, but some problems occurred at execution time, I’m a little confused is that when I want to perform 1*6 When Fourier transform matrix, the first place makes me feel confused : Is when I wrote when you complete the program, its results appear b= 21.0+0.0i b= -3.0+5.2i b= -3+1.7i b= -3 .0+0.0i b= -6444442548.0+0.0i b= 0.0+0.0i Instead of b= 21.0+0.0i b= -3.0+5.2i b= -3+1.7i b= -3 .0+0.0i b= -3.0000 - 1.7321i b= -3.0000 - 5.1962i ã€‚
#include <stdio.h>
#include <stdlib.h>
#include <cufft.h>
#include<cuda.h>
#define H 6
#define B 10
struct complex
{
float re;
float im;
};

int main()
{
float a[H],struct complex b[H];
for(int i=0;i<H;i++)
{
a[i]=i+1;

``````}
cufftHandle plan;
``````

cufftComplex data;
cudaMalloc((void
*)&data,sizeof(cufftComplex)(H/2+1)B);
cudaMemcpy(data,a,sizeof(cufftComplex)
(H/2+1)B,cudaMemcpyHostToDevice);
cufftPlan1d(&plan,H,CUFFT_R2C,B);
cufftExecR2C(plan, (cufftReal
)data, data);
cudaMemcpy(b,data,sizeof(cufftComplex)
(H/2+1)*B,cudaMemcpyDeviceToHost);
for(int i=0;i<H;i++)
{
printf(“b[%d]=%1.1f+%1.1fi\n”,i,b[i].re,b[i].im);
}
cudaFree(data);
cufftDestroy(plan);
system(“PAUSE”);
return 0;
}