473,785 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

custom FFTW lib

Hi,

I'm using FFTW library to do my FFT calculation.
My sample size is so large to get the resolution I want ( >10^7
samples). It's time and memory consuming.
Since I'm just interested in the first 1000 or 10000 points in the
fequency domain. So custom functions will be so useful to me and I can
only calculate the first some points I want.

Here comes the problem. I found no C source code in the FFTW package
even after it's compiled. and I need to find out souce codes of
functions I called and I can rewrite them. Does anyone know how to do
this?
Thank you.
Stanley C
Jul 22 '05 #1
6 3935

"Stanley" <di******@edire ct168.com> wrote in message
news:ef******** *************** ***@posting.goo gle.com...
Hi,

I'm using FFTW library to do my FFT calculation.
My sample size is so large to get the resolution I want ( >10^7
samples). It's time and memory consuming.
Since I'm just interested in the first 1000 or 10000 points in the
fequency domain. So custom functions will be so useful to me and I can
only calculate the first some points I want.

Here comes the problem. I found no C source code in the FFTW package
even after it's compiled. and I need to find out souce codes of
functions I called and I can rewrite them. Does anyone know how to do
this?
Thank you.
Stanley C


I don't know the licensing model of the FFTW libraries, but if they don't
give you the source code, then there's no way to get that source code.
Certainly, compiling won't magically create source code. Compiling does the
reverse: it takes source code and creates libraries or binary executables.

You can either inquire to whoever makes that library as to whether their
source code is available, or you can search around for source code that fits
your needs. (or,of course, write your own). One place to start might be
using groups.google.c om to search for "FFT source".

(By the way, this is a C++ newsgroup, not a C newsgroup. They are different
languages.)

-Howard


Jul 22 '05 #2
"Stanley" <di******@edire ct168.com> wrote in message
news:ef******** *************** ***@posting.goo gle.com...
Hi,

I'm using FFTW library to do my FFT calculation.
My sample size is so large to get the resolution I want ( >10^7
samples). It's time and memory consuming.
Yeah, I would think so. But the resolution in frequency space is 1/period,
independent of the number of samples. You only need gigantic numbers of
samples if you need both very high and very low frequencies -- very unusual
in practice.
Since I'm just interested in the first 1000 or 10000 points in the
fequency domain. So custom functions will be so useful to me and I can
only calculate the first some points I want.
If you are only interested in low frequencies I suggest you subsample or
average down in space domain to reduce the number of points to something
manageable. You don't need custom FFT functions.

For example, if you take your 10^7 raw data points and average in blocks of
100, you will be left with 10000 points which you can transform very easily
to get 10000 points in frequency domain. And, mathematically at least, the
answer will be exactly the same as if you had transformed all 10^7 points
and then discarded all but the first 10000 of the result.

Here comes the problem. I found no C source code in the FFTW package
even after it's compiled. and I need to find out souce codes of
functions I called and I can rewrite them. Does anyone know how to do
this?
FFTW doesn't come with source code. I'll bet it would be too complex to mess
with anyway.
Thank you.
Stanley C


--
Cy
http://home.rochester.rr.com/cyhome/
Jul 22 '05 #3
Stanley wrote in comp.lang.c++:
I'm using FFTW library to do my FFT calculation.
My sample size is so large to get the resolution I want ( >10^7
samples). It's time and memory consuming.
Since I'm just interested in the first 1000 or 10000 points in the
fequency domain. So custom functions will be so useful to me and I can
only calculate the first some points I want.
You can't really do this with FFTW; see the FAQ:
http://www.fftw.org/faq/section3.html#pruned

It may be better for you to just apply the straightforward DFT formula
(or Goertzel, etc.), which for N inputs and K outputs takes O(N K) time,
which isn't bad if K is small. Moreover, it only requires O(K) storage,
so you don't need to keep the whole sequence in memory at once but can
read/compute it on the fly.

Depending on your problem, there may also be *much* more efficient ways
to get the resolution you need.

Anyway, this topic is much appropriate to comp.dsp than to
comp.lang.c++; I'm setting the Followup-To header appropriately.
Here comes the problem. I found no C source code in the FFTW package
even after it's compiled. and I need to find out souce codes of
functions I called and I can rewrite them. Does anyone know how to do
this?


Full source code for FFTW is available at the web site: www.fftw.org

Cordially,
Steven G. Johnson
Jul 22 '05 #4
Cy Edmunds wrote:
Yeah, I would think so. But the resolution in frequency space is 1/period,
independent of the number of samples. You only need gigantic numbers of
samples if you need both very high and very low frequencies -- very unusual
in practice.
This is completely wrong. The frequency resolution is (sampling
frequency) / (number of samples).

The maximum (Nyquist) frequency is (sampling frequency) / 2, which maybe
is what you're thinking of.
For example, if you take your 10^7 raw data points and average in blocks of
100, you will be left with 10000 points which you can transform very easily
to get 10000 points in frequency domain. And, mathematically at least, the
answer will be exactly the same as if you had transformed all 10^7 points
and then discarded all but the first 10000 of the result.
Also completely wrong, I'm afraid. Try it in Matlab:

x = rand(1, 10)
x2 = sum(reshape(x, 2, 5))
y = fft(x)
abs(fft(x2) - y(1:5))

The last term is the error from your approach (here, I'm averaging only
blocks of 2 instead of 100), and it is only zero (within floating point
precision) for the first (DC) term.

Analytical proof of incorrectness left as an exercise for the reader.

The unfortunate fact is that there's no direct way to get the first K
samples of an N-point FFT without modifying the internal algorithm
substantially. (Look up "pruned FFT" in the literature).
FFTW doesn't come with source code.


And...completel y wrong again. See www.fftw.org/download.html

Cordially,
Steven G. Johnson
Jul 22 '05 #5
Stanley wrote:
I'm using FFTW library to do my FFT calculation.
My sample size is so large to get the resolution I want ( >10^7
samples). It's time and memory consuming.
Since I'm just interested in the first 1000 or 10000 points in the
fequency domain. So custom functions will be so useful to me and I can
only calculate the first some points I want.


Since this question comes up frequently, I've posted some explicit
example code on how to efficiently compute the first K outputs from a
DFT of size N, for K << N, with FFTW:

http://www.fftw.org/pruned.html

(The method described at that page has O(N log K) complexity, vs. O(N K)
for applying Goertzel or the naive DFT formula, or O(N log N) for the
full FFT.)

Cordially,
Steven G. Johnson

PS. I'm setting followups to comp.dsp, which is a more appropriate forum
for this question than comp.lang.c++
Jul 22 '05 #6
Thank you Steven.
I was supposed to post it on comp.lang.c, the c++ group is a mistake.
I suvey the source code pack and I thought I was confused by the
codelet and OCAML which I'm not good at.

I'm grade that there is an easier way to solve the problem without
accuracy lost.
I've already seen the code. I'll try it later. :)

Stanley C

"Steven G. Johnson" <st*****@alum.m it.edu> wrote in message news:<40******* *******@alum.mi t.edu>...
Since this question comes up frequently, I've posted some explicit
example code on how to efficiently compute the first K outputs from a
DFT of size N, for K << N, with FFTW:

http://www.fftw.org/pruned.html

(The method described at that page has O(N log K) complexity, vs. O(N K)
for applying Goertzel or the naive DFT formula, or O(N log N) for the
full FFT.)

Cordially,
Steven G. Johnson

PS. I'm setting followups to comp.dsp, which is a more appropriate forum
for this question than comp.lang.c++

Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3616
by: JoePyeWuz | last post by:
Hi, I'm pretty new to using outside libraries...so I don't really understand how to install the FFTW(fast fourier transform made at MIT) library for use with my C++ programs. I have Windows XP and use Bloodshed Dev-C++ Version 2...if anyone could walk me through(please don't make assumptions about what I already know other than how to write C++ code...) it would be a great help, and I would really appreciate it. thanks a ton
4
4352
by: Erica | last post by:
Hi, I am currently working on a program using FFTW-> http://www.fftw.org . My basic C program to compute the 2D Fourier transform of a bunch of data works fine when I compile it with gcc. However, I would like to incorporate that code into a larger program that I wrote with C++. Unfortunately, I cannot get my program to compile with g++. I compile it as follows:
2
3546
by: Marie | last post by:
Hi, I´m trying to perform Fourier Transforms on contiuously incoming images from a camera. I have sofar been using the Basic Interface for planning and execution for every image. Later I have tried to only perform the basic planning once and then using the Guru Interface for execution continuously for each incoming image.
3
2297
by: Fabio Garufi | last post by:
Hi, all, I built the fftw-3.0.1-fma on a LynxOS 4.0 running on a board equipped with a PowerPC G4 7457. To compile it I had to slightly modify the configure script to use the -fvec instead of -faltivec and use the our-malloc16 function. I never could run the checks in tests directory, since they always failed with signal 11. Here follow the core dump and an excerpt from the config.log: core:
5
8102
by: spasmous | last post by:
I'm looking into upgrading from version 2 to version 3 of the FFT code package FFTW (www.fftw.org). The two versions are incompatible - a lot of it has to do with changing from a complex struct with two members (eg. a.re and a.im) to a two element array float (eg. a and a) to hold the real and imaginary parts. So whereas before fftw_complex a;
2
7553
by: John | last post by:
Hi, Has anyone create a DLL for FFTW that can be used from C#? I was able to compile all the .c files and produce .lib's, but I don't think the .libs I created can be used in C#. I tried to create a DLL from the .lib's, but I couldn't figure out how to make it work. Thanks!!!
15
6522
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.