Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
11 Views

How to compute1D FFT of 2D array in another dimension without reshaping the array.

I want to compute 1D FFT of a 2D array stored as a 1D array in another dimension. For example the 2D array is stored as:

for(int j=0; j<NJ; j++) //rows
{
    for(int i=0; i<NI; i++) //colums
        {
            Ori_2D_array[i+j*NI]=1.0;
        }
}

Now I want to compute the 1D FFT of the  Ori_2D_array in the row dimension. The only way I can think out is reshaping the Ori_2D_array then doing the fft:

for (int i=0; i<NI; i++)
{
  for (int j=0; j<NJ; j++)
    {
      2D_array[j+i*NJ]=Ori_2D_array[i+j*NI];
    }
}


DFTI_DESCRIPTOR_HANDLE desc_x = 0;
DftiCreateDescriptor(&desc_x, DFTI_PREC, DFTI_COMPLEX, 1, NJ);
DftiSetValue(desc_x, DFTI_NUMBER_OF_TRANSFORMS, NI);
DftiSetValue(desc_x, DFTI_INPUT_DISTANCE,  NJ);
DftiCommitDescriptor(desc_x);
DftiComputeForward(desc_x, 2D_array);

Reshaping Ori_2D_array wasting too much time. Is there anyway to do the FFT without reshaping Ori_2D_arra.

Please advise!

0 Kudos
0 Replies