I am using FFTW 3.0.1 with a C-program I'm developing. My input data consists of a block of complex data for M channels ordered in the following fashion: input = [ chan1_sample0, chan1_sample1,...,chan1_sampleN-1, chan2_sample0,...,chan2_sampleN-1,...,...,chanM_sample0,...,chanM_sampleN-1] I would like to take advantage of the "Advanced Complex DFT" capability (e.g.-fftw_plan_many_dft()) to avoid having to call the routine for every FFT-size for each channel. If I wanted to take an LF-size fft of the input for each channel, how do I set my arguments accordingly given the abovementioned input layout? In particular, I am confused what to make my "const int *n", "int howmany", "const int *{i,o}nembed", "{i,o}stride", "{i,o}dist", etc. Thanks in advance. Regards, Mark This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Using FFTW with blocks of Complex input...
Started by ●June 16, 2005
Reply by ●June 16, 20052005-06-16
mdholmes wrote:> I am using FFTW 3.0.1 with a C-program I'm developing. My input data > consists of a block of complex data for M channels ordered in the > following fashion: > > input = [ chan1_sample0, chan1_sample1,...,chan1_sampleN-1, > chan2_sample0,...,chan2_sampleN-1,...,...,chanM_sample0,...,chanM_sampleN-1] > > I would like to take advantage of the "Advanced Complex DFT" capability > (e.g.-fftw_plan_many_dft()) to avoid having to call the routine for every > FFT-size for each channel. If I wanted to take an LF-size fft of the > input for each channel, how do I set my arguments accordingly given the > abovementioned input layout? In particular, I am confused what to make my > "const int *n", "int howmany", "const int *{i,o}nembed", "{i,o}stride", > "{i,o}dist", etc. Thanks in advance.n[0] = N howmany=M idist=N istride=1 inembed = onembed = NULL Assuming you use the same layout for the output, odist=idist and ostride=istride. Cordially, Steven G. Johnson PS. You know, all of these parameters *are* documented in the manual.
Reply by ●June 20, 20052005-06-20
I have the manual and have read the related chapters; however, there seems to be some ambiguity in what values the variables should take on. I appreciate the help, though. Using values reflected in your response did not prove any better in running the planner. I believe the problem is in the casting of the data. When I attempt to execute the plan with "complex" data, I get a compile error. However, when I execute on "complex" data cast into "fftw_complex" within the plan call, it compiles and runs. Unfortunately, it does not cast the complex data into equivalent "fftw_complex" data. Do you have to go term by term (for loop) and put the data in Data[j][0] for real and Data[j][1] for imaginary manually? Or is there a way to either execute the plan on "complex" data and/or effectively cast "complex" data to "fftw_complex"? Thanks again. -Mark>n[0] = N >howmany=M >idist=N >istride=1 >inembed = onembed = NULL > >Assuming you use the same layout for the output, odist=idist and >ostride=istride. > >Cordially, >Steven G. Johnson > >PS. You know, all of these parameters *are* documented in the manual. > >This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by ●June 21, 20052005-06-21
mdholmes wrote:> When I attempt to execute the plan with "complex" data, I get a compile > error. However, when I execute on "complex" data cast into "fftw_complex" > within the plan call, it compiles and runs. Unfortunately, it does not > cast the complex data into equivalent "fftw_complex" data. Do you have to > go term by term (for loop) and put the data in Data[j][0] for real and > Data[j][1] for imaginary manually? Or is there a way to either execute > the plan on "complex" data and/or effectively cast "complex" data to > "fftw_complex"? Thanks again.Data[j][0] is the real part and Data[j][1] is the imaginary part; what else is there to understand? Surely you can write a loop yourself? Regarding typecasts, it depends on what "complex" type you are talking about. Conversion from both the C99 complex types and the C++ complex types are described in the reference section of the FFTW manual. It sounds like you are having basic problems with the C language, and comp.lang.c might be a more appropriate forum (or comp.lang.c++ if you are using C++). Cordially, Steven G. Johnson
Reply by ●June 22, 20052005-06-22
>Data[j][0] is the real part and Data[j][1] is the imaginary part; what >else is there to understand? Surely you can write a loop yourself? > >Regarding typecasts, it depends on what "complex" type you are talking >about. Conversion from both the C99 complex types and the C++ complex >types are described in the reference section of the FFTW manual. > >It sounds like you are having basic problems with the C language, and >comp.lang.c might be a more appropriate forum (or comp.lang.c++ if you >are using C++). > >Cordially, >Steven G. Johnson >For the record, this is in C. Also, I completely understand the data type (e.g.-Data[j][0],Data[j][1]...) fftw_complex has. The manual makes it seem as if you don't *need* to put it in that type, however. As long as you put your #include <Complex.h> before the #include <fftw3.h>. A simple for loop is easy, yes. However, it is also inefficient. If the fftw supports "complex" data types, I would like to take advantage of not having to run a loop every time to cast it into fftw_complex data. However, if it is not supported, in fact, then I'll have to do it the old fashion way. I appreciate your help, Steven. Maybe my questions are too vague and/or you are receiving them wrong. I don't think the problem is a comfort level with the C language by any means. Regards, Mark This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by ●June 23, 20052005-06-23
If you #include <complex.h> (*not* <Complex.h>, whatever that is) before fftw.h, *and* your compiler is C99-compliant (at least as far as complex types go), then fftw_complex is the same thing as C99's "double complex" type, as described in the manual. If you are using some non-C99 complex data type or your compiler is not C99-compliant, then this will not work. However, if your complex data type consists of the real part followed by the imaginary part (e.g. struct { double real, imag; }) then it should be bit compatible with fftw_complex and you can just typecast your array pointer when passing to FFTW. Steven
Reply by ●June 28, 20052005-06-28
The problem lies in the Complex.h, as you indicated. Apparently, I had a local "Complex.h" that I was including (used company-wide) as opposed to the widely accepted standard C-version, <complex.h>. Thanks again for your help. -Mark>If you #include <complex.h> (*not* <Complex.h>, whatever that is) >before fftw.h, *and* your compiler is C99-compliant (at least as far as >complex types go), then fftw_complex is the same thing as C99's "double >complex" type, as described in the manual. > >If you are using some non-C99 complex data type or your compiler is not >C99-compliant, then this will not work. However, if your complex data >type consists of the real part followed by the imaginary part (e.g. >struct { double real, imag; }) then it should be bit compatible with >fftw_complex and you can just typecast your array pointer when passing >to FFTW. > >Steven > >This message was sent using the Comp.DSP web interface on www.DSPRelated.com