<?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 Thank you very much for root in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122913#M25072</link>
    <description>&lt;P&gt;Thank you very much for root-causing this issue.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2016 05:00:10 GMT</pubDate>
    <dc:creator>Evgueni_P_Intel</dc:creator>
    <dc:date>2016-03-30T05:00:10Z</dc:date>
    <item>
      <title>Unexpected Results of 3D Not Inplace FFT</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122908#M25067</link>
      <description>&lt;P&gt;The following is my C code snipped illustrating a problem.&lt;/P&gt;

&lt;P&gt;I set dim1/dim2/dim3 to all be the next higher power of 2 based on the lengths&lt;BR /&gt;
	of the actual input data.&amp;nbsp; My test that works has&lt;BR /&gt;
	all dims set to 1024 (not by design, it just happened that way).&amp;nbsp; I have&lt;BR /&gt;
	the data padded with 0s in all locations for the pad.&lt;/P&gt;

&lt;P&gt;The routine works correctly for the above case.&amp;nbsp; I compare the values&lt;BR /&gt;
	created in the DftiComputeBackward call to the input data, and the differences&lt;BR /&gt;
	are at 10 to the minus 8.&lt;/P&gt;

&lt;P&gt;However, when I increase just the dim2 amount to 2048, the output is virtually identical,&lt;BR /&gt;
	but the phase is 180 degrees off, i.e., the sign of the values are flipped.&lt;/P&gt;

&lt;P&gt;The same holds true when I increase just dim3 to 2048, identical output except for&lt;BR /&gt;
	the signs.&lt;/P&gt;

&lt;P&gt;Again, I am looking at the 'traceout' array created in DftiComputeBackward.&lt;/P&gt;

&lt;P&gt;Thanks for any suggestions;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;void doit( int dim2, int dim1, int dim3, float *tracein, float *traceout, complex *in_fft_c) {&lt;/P&gt;

&lt;P&gt;&amp;nbsp; float back_scale;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; MKL_LONG istat;&lt;BR /&gt;
	&amp;nbsp; MKL_LONG size[3];&lt;BR /&gt;
	&amp;nbsp; MKL_LONG rs[4], cs[4];&lt;/P&gt;

&lt;P&gt;&amp;nbsp; DFTI_DESCRIPTOR_HANDLE dfti;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; /* set sizes (includes pad) */&lt;BR /&gt;
	&amp;nbsp; size[0] = dim1;&lt;BR /&gt;
	&amp;nbsp; size[1] = dim2;&lt;BR /&gt;
	&amp;nbsp; size[2] = dim3;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; /* set scale for inverse fft */&lt;BR /&gt;
	&amp;nbsp; back_scale = 1.0/(dim1*dim2*dim3);&lt;/P&gt;

&lt;P&gt;&amp;nbsp; /* set strides for out of place real and complex transforms */&lt;BR /&gt;
	&amp;nbsp; rs[3] = 1;&lt;BR /&gt;
	&amp;nbsp; rs[2] = dim3;&lt;BR /&gt;
	&amp;nbsp; rs[1] = dim2*dim3;&lt;BR /&gt;
	&amp;nbsp; rs[0] = 0;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; cs[3] = 1;&lt;BR /&gt;
	&amp;nbsp; cs[2] = dim3/2+1;&lt;BR /&gt;
	&amp;nbsp; cs[1] = dim2*(dim3/2+1);&lt;BR /&gt;
	&amp;nbsp; cs[0] = 0;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; istat&amp;nbsp; = DftiCreateDescriptor( &amp;amp;dfti, DFTI_SINGLE, DFTI_REAL, 3, size );&lt;BR /&gt;
	&amp;nbsp; istat += DftiSetValue( dfti, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX );&lt;BR /&gt;
	&amp;nbsp; istat += DftiSetValue( dfti, DFTI_PLACEMENT, DFTI_NOT_INPLACE&amp;nbsp; );&lt;BR /&gt;
	&amp;nbsp; istat += DftiSetValue( dfti, DFTI_OUTPUT_STRIDES , cs&amp;nbsp; );&lt;BR /&gt;
	&amp;nbsp; istat += DftiCommitDescriptor( dfti );&lt;/P&gt;

&lt;P&gt;&amp;nbsp; istat += DftiComputeForward&amp;nbsp; ( dfti, tracein , in_fft_c&amp;nbsp; );&lt;/P&gt;

&lt;P&gt;&amp;nbsp; istat += DftiSetValue( dfti, DFTI_INPUT_STRIDES&amp;nbsp; , cs&amp;nbsp; );&lt;BR /&gt;
	&amp;nbsp; istat += DftiSetValue( dfti, DFTI_OUTPUT_STRIDES , rs&amp;nbsp; );&lt;BR /&gt;
	&amp;nbsp; istat += DftiSetValue (dfti, DFTI_BACKWARD_SCALE, back_scale);&lt;BR /&gt;
	&amp;nbsp; istat += DftiCommitDescriptor( dfti );&lt;/P&gt;

&lt;P&gt;&amp;nbsp; istat += DftiComputeBackward ( dfti, in_fft_c, traceout );&lt;/P&gt;

&lt;P&gt;&amp;nbsp; istat += DftiFreeDescriptor(&amp;amp;dfti);&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 17:55:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122908#M25067</guid>
      <dc:creator>Andy_K_</dc:creator>
      <dc:date>2016-03-24T17:55:35Z</dc:date>
    </item>
    <item>
      <title>Further info, I input a</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122909#M25068</link>
      <description>&lt;P&gt;Further info, I input a completely different set of data where it was a 256x256x1024 transform, and the output sign was &lt;STRONG&gt;not&lt;/STRONG&gt; flipped.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 18:10:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122909#M25068</guid>
      <dc:creator>Andy_K_</dc:creator>
      <dc:date>2016-03-24T18:10:13Z</dc:date>
    </item>
    <item>
      <title>For the forward transform,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122910#M25069</link>
      <description>&lt;P&gt;For the&amp;nbsp;forward transform, the following line is missing:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; istat += DftiSetValue( dfti, DFTI_INPUT_STRIDES&amp;nbsp; , rs&amp;nbsp; );&lt;/P&gt;

&lt;P&gt;Unless you want to transpose data implicitly, the strides are in the reversed order -- please use the following:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; rs[3] = dim1*dim2;&lt;BR /&gt;
	&amp;nbsp; rs[2] = dim1;&lt;BR /&gt;
	&amp;nbsp; rs[1] = 1;&lt;BR /&gt;
	&amp;nbsp; rs[0] = 0;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; cs[3] = dim2*(dim1/2+1);&lt;BR /&gt;
	&amp;nbsp; cs[2] = dim1/2+1;&lt;BR /&gt;
	&amp;nbsp; cs[1] = 1;&lt;BR /&gt;
	&amp;nbsp; cs[0] = 0;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 18:12:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122910#M25069</guid>
      <dc:creator>Evgueni_P_Intel</dc:creator>
      <dc:date>2016-03-24T18:12:34Z</dc:date>
    </item>
    <item>
      <title>That didn't workl.  Perhaps I</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122911#M25070</link>
      <description>&lt;P&gt;That didn't work.&amp;nbsp; Perhaps I have my data ordered incorrectly, and the strides are more complicated.&lt;/P&gt;

&lt;P&gt;From my original post, the 'tracein' array is composed of three logical entities.&amp;nbsp; Let's call them A,B,C using the previously noted variables dim1, dim2, dim3 for the lengths.&amp;nbsp; The memory storage is&lt;/P&gt;

&lt;P&gt;(offset) (C array element)&lt;/P&gt;

&lt;P&gt;0 = A[0],B[0],C[0]&lt;/P&gt;

&lt;P&gt;1 = A[0],B[0],C[1]&lt;/P&gt;

&lt;P&gt;2 = A[0],B[0],C[2]&lt;/P&gt;

&lt;P&gt;...&lt;/P&gt;

&lt;P&gt;dim3-1 = A[0],B[0],C[dim3-1]&lt;/P&gt;

&lt;P&gt;dim3 = A[0],B[1],C[0]&lt;/P&gt;

&lt;P&gt;dim3+1 = A[0],B[1],C[1]&lt;/P&gt;

&lt;P&gt;and so on.&amp;nbsp; The A[1],B[0],C[0] element would occur at memory offset dim2*dim3&lt;/P&gt;

&lt;P&gt;I usually can figure this out by looking at examples, but I can't seem to find one that fits my case, especially for NOT_INPLACE transforms.&lt;/P&gt;

&lt;P&gt;Someone posted a question on 2d FFT which is I think similar to my question.&lt;/P&gt;

&lt;P&gt;Once again, thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 13:08:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122911#M25070</guid>
      <dc:creator>Andy_K_</dc:creator>
      <dc:date>2016-03-28T13:08:00Z</dc:date>
    </item>
    <item>
      <title>I figured this out on my own.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122912#M25071</link>
      <description>&lt;P&gt;I figured this out on my own.&lt;/P&gt;

&lt;P&gt;The code snippet I posted was essentially correct.&amp;nbsp; The problem was unexpectedly in the following line;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; back_scale = 1.0/(dim1*dim2*dim3);&lt;/P&gt;

&lt;P&gt;Since dim1, dim2, and dim3 are ints, the divisor was also computed as a 32 bit signed int and it overflowed (1024*1024*2048), and back_scale became a minus 1.&lt;/P&gt;

&lt;P&gt;The input and output strides were correct, and the input strides did not need specified for the compute_forward.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2016 20:11:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122912#M25071</guid>
      <dc:creator>Andy_K_</dc:creator>
      <dc:date>2016-03-29T20:11:19Z</dc:date>
    </item>
    <item>
      <title>Thank you very much for root</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122913#M25072</link>
      <description>&lt;P&gt;Thank you very much for root-causing this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 05:00:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Unexpected-Results-of-3D-Not-Inplace-FFT/m-p/1122913#M25072</guid>
      <dc:creator>Evgueni_P_Intel</dc:creator>
      <dc:date>2016-03-30T05:00:10Z</dc:date>
    </item>
  </channel>
</rss>

