# Normalization for IFFT How to do normalization for ifft?

Dear all,

I am new to CUDA and doing FFT on image but for my learning and for a starting i am doing FFT on real array and then wants to do IFFT on the result to produce the same array. I know that for real array i have to pad the input array to get the whole complex result. the result of FFT is good but when i am doing IFFT on it the result is not the same to input array. i studied about the problem and came to know that i have to do Normalization but i didn’t get any idea that how i can do normalization. my example is very simple just an array of 16 real float elements. Can any one please guide me how i can do normalization. if you need i can also my code here. Please respond to the question quickly if possible.

Thanks

IFFT(FFT(A))=len(A)*A

Dear mfatica first of all thanks for your reply. I have wrote a code for 1D C2C transformation but it is not giving the desired result. Will you please give a look at it.

#include <stdio.h>
#include <cufft.h>
#include <cuda.h>
#include <conio.h>
#include
#include
using namespace std;
#define N 16
#define BATCH 10
int main()
{
float in[16]={12,23,45,24,45,56,23,45,78,89,12,23,45,45,98,78};
cufftComplex *in1_d;
cufftComplex *out1_d;
cufftComplex out1[16];
int i;
cufftComplex in1[16];
for(i=0;i<16;i++)
{
in1[i].x=0;
in1[i].y=in[i];}

``````for(i=0;i<16;i++)
cout<<in1[i].x<<in1[i].y<<endl;

cudaMalloc((void**)&in1_d,sizeof(cufftComplex)*(N/2+1)*BATCH);
cudaMalloc((void**)&out1_d,sizeof(cufftComplex)*N*BATCH);
cudaMemcpy(in1_d,in1,sizeof(cufftComplex)*(N/2+1)*BATCH,cudaMemcpyHostToDevice);
cufftHandle plan;
cufftPlan1d(&plan,N,CUFFT_C2C,BATCH);
cufftExecC2C(plan,(cufftComplex*)in1_d,(cufftComplex*)out1_d,CUFFT_FORWARD);
cudaMemcpy(out1,out1_d,sizeof(cufftComplex),cudaMemcpyDeviceToHost);

printf("\n");
for (i=0;i<16;i++)
{
``````

cout<<out1[i].x;printf("\t");
cout<<out1[i].y;
printf("\n");
}

getch();}

I am new to CUDA so there must be silly mistakes so please don’t be angry.
Looking forward for a favorable response.
thanks