[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


FFT 1D & 2D code with fixed point math..

Posted on 2000-05-10
Medium Priority
Last Modified: 2008-03-17
Hi there,
I'm trying to code Fast Fourier Transform here..
Yup.. I can get the code from some internet site..
But those code seems to use float data type.. Which takes longer time to be executed on non floating-point h/w processor..
I just wonder.. maybe some of you or some people has already code this?
And could you point me the code?
or share the code with me?
or any suggestion?


Question by:wayud
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
LVL 14

Expert Comment

ID: 2798824
You can find code of FFT in many URL.
For example http://www.dc.ee/Files/Programm.C
BUT: all codes use sin/cos and log (of course). Next depend not from code, but from translator: how translator realyze this operation? If with help
of floating point(and you computer without fp processor) will be used simulation, that slows down computation.
Of course , you can use you own cos/sin and log(but to write code, that works
faster that standart: not easy task).


Expert Comment

ID: 2800228
You can improve the speed of most FFT algorithms by a careful adjustment of the sequence of math operations and good use of pointers.
Make sure it does the fastest math first, ie never do x = c*a + b*a make sure it does x = (c+b)*a.
Make sure it doesn't shuffle stuff between arrays for no good reason, and make sure it doesn't have to do wasteful address calculations, like don't do y[2n+1] = z[2n+1] figure out
the index first also figure out if your compiler does pointer+offset faster than array[index].
If you don't need great resolution (which you wouldn't get with integer) don't use sin and cos repeatedly, try a lookup table.
LVL 14

Expert Comment

ID: 2811744
wayud, what do you think about me and
3rsrichard comments?

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 84

Expert Comment

ID: 2812468
You could also do integer FFTs using roots of unity in the ring of integers modulo 2^n+1 instead of roots of unity in the complex ring

Author Comment

ID: 2813040
Thank you guys,
for your comment...
I've read a book about perform fixed point mathmatic on non floating-point processor..
It is by using 16-bit integer data type for all data..
then perform shift operation to adjust the result..
And also we have to use lookup table (which is also integer data type) instead of using sin& cos function in the code..
Alex, I don't understand what you mean by translator, and then simulation?
Thank 3rsrichard,.. yes.. I have done that..
ozo, I don't understand what you mean..
roots of unity in the ring of integers? it sounds too mathmatical for me..
LVL 14

Expert Comment

ID: 2813074
>>Alex, I don't understand what you mean by translator, and then simulation?

Usually,for making float computation
every translator(VC,BC,gcc,...) may use 2 ways:
1. Using floating coprocessor(and in this case it is fast)
2. Using simulation of floating computation without co-processor(and it is more slow).
Every function as cos, sin, lg,.. computes as summ of sequence by some formula with some accuraticy(depends from type of data: float,double, long double).
I means, that you can rewrite  such functions(say mycos, mysin,...), but
it is not easy task .

Expert Comment

ID: 2814661
And, I recalled, there is an incremental version of FFT.  For instruments like signal analysers you don't have to do all the math at once, but get to spread it out over time.
I haven't looked at it in a looong time.
LVL 14

Expert Comment

ID: 2826754
LVL 14

Accepted Solution

AlexVirochovsky earned 150 total points
ID: 2881925
By you silence, i hope, that my and
3rsrichard comments help you.

To 3rsrichard : if I get PTS, I 'll send you same summ.

Author Comment

ID: 2884766
Answer accepted

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question