<?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 Using FFTInitAlloc in C# in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915584#M15073</link>
    <description>&lt;P&gt;I'm currently writing an application in C# using the IPP libraries for FFT analysis. The application will be aquiring torque data at 40Hz and performing an FFT roughly every 2 seconds looking for vibration as indicated by certain cyclic frequencies, and will be expected to operate continuously for days at a time. I've downloaded the ms.net samples in order to use the wrappers in them, and I've looked through the posts in this forum for information. Using the information in thread 5481746 I can use FFTInitAlloc to create the specification structure by declaring them locally within the method, however I really only want to have to do this once, ie within a class constructor, or an intialization method, then have the FFT method run using the allocated specification structures. If I declare the IppsFFTSpec_R_64f structure as a member of the class and use new to initialize a memory allocation for it, then the following code &lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;spec = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; IppsFFTSpec_R_64f();&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ipp.IppsFFTSpec_R_64f* pFFTSpec = &amp;amp;spec;&lt;/P&gt;
&lt;P&gt;sp.ippsFFTInitAlloc_R_64f(&amp;amp;pFFTSpec,lenFFTOrder,(&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT size="2"&gt;)fft_order.IPP_FFT_DIV_FWD_BY_N, IppHintAlgorithm.ippAlgHintNone);&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT size="3"&gt;in the initialization method fails to compile with the error:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;You can only take the address of an unfixed expression inside of a fixed statement initializer.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Ok, the obvious move is to fix the pointer declaration like so :&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;spec = &lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; IppsFFTSpec_R_64f();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;fixed(ipp.IppsFFTSpec_R_64f* pFFTSpec = &amp;amp;spec)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sp.ippsFFTInitAlloc_R_64f(&amp;amp;pFFTSpec,lenFFTOrder,(&lt;FONT color="#0000ff" size="2"&gt;int)&lt;/FONT&gt;&lt;FONT size="2"&gt;fft_order.IPP_FFT_DIV_FWD_BY_N, IppHintAlgorithm.ippAlgHintNone);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;This however fails to compile with the error&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Cannot take the address of the given expression&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Can anyone suggest a way forward here, preferably one that doesn't involve performing the InitAlloc locally before each iteration of the FFT?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2006 00:00:50 GMT</pubDate>
    <dc:creator>paul_brown</dc:creator>
    <dc:date>2006-07-20T00:00:50Z</dc:date>
    <item>
      <title>Using FFTInitAlloc in C#</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915584#M15073</link>
      <description>&lt;P&gt;I'm currently writing an application in C# using the IPP libraries for FFT analysis. The application will be aquiring torque data at 40Hz and performing an FFT roughly every 2 seconds looking for vibration as indicated by certain cyclic frequencies, and will be expected to operate continuously for days at a time. I've downloaded the ms.net samples in order to use the wrappers in them, and I've looked through the posts in this forum for information. Using the information in thread 5481746 I can use FFTInitAlloc to create the specification structure by declaring them locally within the method, however I really only want to have to do this once, ie within a class constructor, or an intialization method, then have the FFT method run using the allocated specification structures. If I declare the IppsFFTSpec_R_64f structure as a member of the class and use new to initialize a memory allocation for it, then the following code &lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;spec = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; IppsFFTSpec_R_64f();&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ipp.IppsFFTSpec_R_64f* pFFTSpec = &amp;amp;spec;&lt;/P&gt;
&lt;P&gt;sp.ippsFFTInitAlloc_R_64f(&amp;amp;pFFTSpec,lenFFTOrder,(&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT size="2"&gt;)fft_order.IPP_FFT_DIV_FWD_BY_N, IppHintAlgorithm.ippAlgHintNone);&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT size="3"&gt;in the initialization method fails to compile with the error:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;You can only take the address of an unfixed expression inside of a fixed statement initializer.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Ok, the obvious move is to fix the pointer declaration like so :&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;spec = &lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; IppsFFTSpec_R_64f();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;fixed(ipp.IppsFFTSpec_R_64f* pFFTSpec = &amp;amp;spec)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;sp.ippsFFTInitAlloc_R_64f(&amp;amp;pFFTSpec,lenFFTOrder,(&lt;FONT color="#0000ff" size="2"&gt;int)&lt;/FONT&gt;&lt;FONT size="2"&gt;fft_order.IPP_FFT_DIV_FWD_BY_N, IppHintAlgorithm.ippAlgHintNone);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;This however fails to compile with the error&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Cannot take the address of the given expression&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Can anyone suggest a way forward here, preferably one that doesn't involve performing the InitAlloc locally before each iteration of the FFT?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2006 00:00:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915584#M15073</guid>
      <dc:creator>paul_brown</dc:creator>
      <dc:date>2006-07-20T00:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using FFTInitAlloc in C#</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915585#M15074</link>
      <description>&lt;P&gt;Paul, &lt;/P&gt;
&lt;P&gt;you can and should do init fft once and call fft transform as many times as you need if you don't change theorder.&lt;/P&gt;
&lt;P&gt;about initalloc func with spec param, hope the following example helps&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;using System;&lt;BR /&gt;using ipp;&lt;BR /&gt;unsafe public class one {&lt;BR /&gt; public static void Main() {&lt;BR /&gt; IppLibraryVersion lib = sp.ippsGetLibVersion();&lt;BR /&gt; Console.WriteLine(" {0} {1}", lib.Name, lib.Version );&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; float[] a = {1,2,3,4};&lt;BR /&gt; float[] b = {11,12,13,14};&lt;BR /&gt; float[] c = new float[4];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; Ipp32fc v = new Ipp32fc(1,2);&lt;BR /&gt; fixed(float*pa=a){ sp.ippsAddC_32fc_I( v, pa, 2); }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; fixed(float*pa=a,pb=b,pc = c){sp.ippsAdd_32f( pa, pb, pc, 4 );}&lt;BR /&gt; Console.WriteLine(" {0},{1},{2},{3}
",c[0],c[1],c[2],c[3]);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt; IppsFFTSpec_R_32f*p;&lt;BR /&gt; sp.ippsFFTInitAlloc_R_32f( &amp;amp;p, 2, 2, IppHintAlgorithm.ippAlgHintNone );&lt;BR /&gt; ulong start = sp.ippGetCpuClocks();&lt;BR /&gt; fixed(float*pa=a,pc=c){sp.ippsFFTFwd_RToPerm_32f( pa, pc, p, null );}&lt;BR /&gt; ulong stop = sp.ippGetCpuClocks();&lt;BR /&gt; sp.ippsFFTFree_R_32f( p );&lt;BR /&gt; Console.WriteLine(" {0},{1},{2},{3}
",c[0],c[1],c[2],c[3]);&lt;BR /&gt; Console.WriteLine( " cpu = {0}
 clocks = {1}", sp.ippGetCpuType(), stop-start );&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Aug 2006 22:50:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915585#M15074</guid>
      <dc:creator>borix</dc:creator>
      <dc:date>2006-08-06T22:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using FFTInitAlloc in C#</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915586#M15075</link>
      <description>&lt;P&gt;Borix,&lt;/P&gt;
&lt;P&gt; Thanks for replying. I'm using the InitAlloc with the Spec param pretty much as you do in your example, and that works, but the problem I was trying to solve was how to delcare the InitAlloc prior to starting the worker thread which does the FFT, so I would only call InitAlloc once no matter how many thousands of times the FFT is run in my application. I have managed to get round the compiler errors however I think I'm then getting bitten by garbage collection moving the memory allocation around, and have gone back to using it as in your example.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2006 23:40:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Using-FFTInitAlloc-in-C/m-p/915586#M15075</guid>
      <dc:creator>paul_brown</dc:creator>
      <dc:date>2006-09-06T23:40:12Z</dc:date>
    </item>
  </channel>
</rss>

