Fast Fourier Transform
Asked Answered
C

3

14

I need to multiply two polynomials each having small integral coefficients. I need a fast FFT routine in C/C++ which can convolve them. I have seen several libraries but they seem to be too large spread over multiple files. What is important is I need code which is not too long and can be very easily used and compiled in a single .c/.cpp file.

  1. FFT should be optimized for real inputs at least if not small integers.
  2. Radix 4 implementation if available would be fine too.
  3. Compiling it should take no special compilation flags as compilation of program has to be done in external environment which I can't control.

One that very well matches my needs is here. But I need something twice as fast.

Calycle answered 10/3, 2011 at 4:30 Comment(4)
What's your question? I need a million dollars. Also, I like cheese. A LOT.Ortegal
@muntoo - Real polynomial convolution is an important problem in itself and hence I think its natural to ask this question. I don't need full power of FFT but just a specific small subset and the fact that there IS an OS implementation almost suiting my needs, means that it is not unrealistic either.Calycle
How large are the polynomials? FFT has better complexity than direct convolution, but also a significantly higher constant, for small problems direct convolution would be faster.Chandrachandragupta
Pretty large. Degree is around 10^6. I am sure an O(N^2) algorithm won't run in any reasonable time.Calycle
A
21

For a straightforward and easy to use FFT implementation try KissFFT. If you need absolute maximum performance though, and don't mind a little complexity, then it has to be FFTW.

Alcazar answered 10/3, 2011 at 8:24 Comment(0)
W
3

I've adapted the smbFft function from this example on DspDimension to my needs in the past.

Whitmore answered 10/3, 2011 at 4:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.