Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6982 Discussions

computing inverser fourier transform when output length is small then input

raavi
Beginner
498 Views

I have a input matrix whose size is (lg_child, lt_parent)and it is defined as

 

 

filterd_fourier_coefficients(lg_child, lt_parent)

 

 

 For each lg_child I  take samples of length lt_parent and perform inverse Fourier transformation. 

The setup is,

 

 

DFTI_DESCRIPTOR_HANDLE ifft = NULL;
status = DftiCreateDescriptor(&ifft, DFTI_DOUBLE, DFTI_COMPLEX, 1, lt_parent);
status = DftiSetValue        ( ifft, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status = DftiCommitDescriptor( ifft);

 

 

The input and output is defined as

 

 

std::complex<double> samples_in[lt_parent];
std::complex<double> samples_out[lt_parent];

for (int l=0; l<lt_parent; l++)
{
   samples_in[l] = filterd_fourier_coefficients(j, l);
}   

status = DftiComputeBackward(ifft, samples_in, samples_out);

 

 

The output matrix is filtered_grid(lt_child, lg_child) and (lt_child < lt_parent)

 

 

for (int i=0; i<lt_child; i++)
{
   double phi = trapezoidal_child.get_nodes(i);    
    
   filtered_grid(i, j) = sqrt(2.0 * pi)           * 
                         Internal::expi(-K * phi) *  
                         samples_out[i];
}        

 

 

 results in bad filtering.

Info: The input matrix is normalized with (1/lt_parent)

What do I have to do when truncating the samples_out and what exactly is missing?

0 Kudos
4 Replies
raavi
Beginner
442 Views

Fixed: Rather a trivial one but there is one more problem.

Its the part of the implementation of Fast Spherical Filter to interpolate or filter the samples on the sphere.

The steps involve

  1. Compute the Fourier co-efficients of samples the latitude
  2. Compute the spherical co-efficients from 1.
  3. Compute the filtered Fourier co-efficients from 2.
  4. Finally the filtered grid where the inverse Fourier transformation is performed on filtered Fourier co-efficients

Before attempt to use APIs from Intel, I manually computed the DFT and IDFT in step 1 and 4. Nevertheless the bug is rather trivial and nothing to do with Intel APIs at all.

 

This is the bug where I miss-allocated the longitude and latitude samples of the sphere.

 

filtered_grid(lg_child, lt_child)

 

 it should be

 

filtered_grid(lt_child, lg_child)

 

 

 

0 Kudos
Gennady_F_Intel
Moderator
414 Views

I'm just interested, what fix did you apply?


0 Kudos
raavi
Beginner
396 Views

Though it works with manual computation of Inverse Fourier Transform, I still have a difficulty in using the API to get the correct truncated values.

DFTI_DESCRIPTOR_HANDLE ifft_handle = NULL;
status = DftiCreateDescriptor(&ifft_handle, DFTI_DOUBLE,    DFTI_COMPLEX, 1, lt_parent);
status = DftiSetValue        ( ifft_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status = DftiCommitDescriptor( ifft_handle);

for (int j=0; j<lg_child; j++)                
{                            
    std::complex<double> x_coefficients_in[lt_parent];
    std::complex<double> x_coefficients_out[lt_parent];

    for (int l=0; l<lt_parent; l++)
    {
        x_coefficients_in[l] = filterd_fourier_coefficients(j, l);
    }   
                
    status = DftiComputeBackward(ifft_handle, x_coefficients_in, x_coefficients_out);

    for (int i=0; i<lt_child; i++)
    {
        double phi          = trapezoidal_child.get_nodes(i);        
        filtered_grid(i, j) = sqrt(2.0 * pi) * Internal::expi(-K * phi) * x_coefficients_out[i];
    }        
}
    
status = DftiFreeDescriptor(&ifft_handle);

 I have an input x_coefficients_in whose length is lt_parent and after transformation how do I truncate to length lt_child?

 

Info: lt_parent > lt_child

 

The code which I have posted does not give the correct results.

0 Kudos
raavi
Beginner
405 Views

Any help in computing the truncation will be much appreciated.

0 Kudos
Reply