<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re:What is the proper way to zero-pad a 2d data and perform backward transformation? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/What-is-the-proper-way-to-zero-pad-a-2d-data-and-perform/m-p/1609398#M36221</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting in the forum!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I'm trying to understand the issue here. It looks the code is trying to zero-pad the Fourier coefficients after the FFT. Could you please provide more information about what this zero-padding is trying to achieve and what output is expected?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Fengrui&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 24 Jun 2024 20:44:12 GMT</pubDate>
    <dc:creator>Fengrui</dc:creator>
    <dc:date>2024-06-24T20:44:12Z</dc:date>
    <item>
      <title>What is the proper way to zero-pad a 2d data and perform backward transformation?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/What-is-the-proper-way-to-zero-pad-a-2d-data-and-perform/m-p/1604463#M36186</link>
      <description>&lt;P&gt;I am trying to understand the correct way to zero-pad the 2d-data.&lt;BR /&gt;&lt;BR /&gt;This way I did not get the correct output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;MKL_LONG dim_child[2];

dim_child[0]                                 = 9;
dim_child[1]                                 = 17;

MKL_LONG dim_parent[2];

dim_parent[0]                                = 12;
dim_parent[1]                                = 23;

MKL_LONG                                     status;
DFTI_DESCRIPTOR_HANDLE frwd_hndl             = NULL;
DFTI_DESCRIPTOR_HANDLE bkwd_hndl             = NULL;

double forward_scale                         = sqrt(2.0 * pi) / static_cast&amp;lt;double&amp;gt;(dim_child[0] * dim_child[1]);  

status                                       = DftiCreateDescriptor(&amp;amp;frwd_hndl, DFTI_DOUBLE, DFTI_COMPLEX, 2, dim_child);
status                                       = DftiSetValue(frwd_hndl, DFTI_FORWARD_SCALE, forward_scale);   
status                                       = DftiCommitDescriptor(frwd_hndl);

status                                       = DftiCreateDescriptor(&amp;amp;bkwd_hndl, DFTI_DOUBLE, DFTI_COMPLEX, 2, dim_parent);    
status                                       = DftiCommitDescriptor(bkwd_hndl);

int size_child                               = dim_child[0]  * dim_child[1];
int size_parent                              = dim_parent[0] * dim_parent[1];

MKL_Complex16 *fourier_coeff                 = NULL;
MKL_Complex16 *filterd_coeff                 = NULL;    
fourier_coeff                                = (MKL_Complex16*)mkl_malloc(size_child  * sizeof(MKL_Complex16), 64);
filterd_coeff                                = (MKL_Complex16*)mkl_malloc(size_parent * sizeof(MKL_Complex16), 64);
            
for (int j=0; j&amp;lt;lg_child; j++)
{
    for (int i=0; i&amp;lt;lt_child; i++)
    {
        int index                            = i + (j*lt_child);

        fourier_coeff[index].real 			 = // some_value;                        
        fourier_coeff[index].imag 			 = // some_value;                                               
    }            
}   

status                                       = DftiComputeForward(frwd_hndl, fourier_coeff);
status                                       = DftiFreeDescriptor(&amp;amp;frwd_hndl);
   	         
for (int j_prime=0; j_prime&amp;lt;lg_parent; j_prime++)       
{                                                
    for (int j=0; j&amp;lt;lg_child; j++)
    {
        for (int i=0; i&amp;lt;lt_child; i++)
        {   
            int index                        = i + (j       * lt_child);            
            int index_filter                 = i + (j_prime * lt_parent);           
            
            // zero-padding at the end of each row of length (lt_parent - lt_child)
            // [x x x x x x x x x x x x x x x x x 0 0 0 0 0 0 x x x x x x x x x x x x x x x x x 0 0 0 0 0 0...]
            //  _______________17________________ _____6_____
                                    
            filterd_coeff[index_filter].real += (fourier_coeff[index].real);
            filterd_coeff[index_filter].imag += (fourier_coeff[index].imag);
        }   
    }            
}        

status                                       = DftiComputeBackward(bkwd_hndl, filterd_coeff);
status                                       = DftiFreeDescriptor(&amp;amp;bkwd_hndl);  
        
for (int j=0; j&amp;lt;lg_parent; j++)
{            
    for (int i=0; i&amp;lt;lt_parent; i++)
    {                                
        int index                            = i + (j*lt_parent);
        
        std::cout &amp;lt;&amp;lt; filterd_coeff[index].real&amp;lt;&amp;lt;"\t"&amp;lt;&amp;lt;filterd_coeff[index].imag&amp;lt;&amp;lt;std::endl;       
    }
}

mkl_free(fourier_coeff);        
mkl_free(filterd_coeff);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 11:38:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/What-is-the-proper-way-to-zero-pad-a-2d-data-and-perform/m-p/1604463#M36186</guid>
      <dc:creator>raavi</dc:creator>
      <dc:date>2024-06-06T11:38:09Z</dc:date>
    </item>
    <item>
      <title>Re:What is the proper way to zero-pad a 2d data and perform backward transformation?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/What-is-the-proper-way-to-zero-pad-a-2d-data-and-perform/m-p/1609398#M36221</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting in the forum!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I'm trying to understand the issue here. It looks the code is trying to zero-pad the Fourier coefficients after the FFT. Could you please provide more information about what this zero-padding is trying to achieve and what output is expected?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Fengrui&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2024 20:44:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/What-is-the-proper-way-to-zero-pad-a-2d-data-and-perform/m-p/1609398#M36221</guid>
      <dc:creator>Fengrui</dc:creator>
      <dc:date>2024-06-24T20:44:12Z</dc:date>
    </item>
  </channel>
</rss>

