How to Implement FFT and Linear Optimization in C++?

  • Context: C/C++ 
  • Thread starter Thread starter orstats
  • Start date Start date
  • Tags Tags
    C++ Fourier
Click For Summary

Discussion Overview

The discussion revolves around implementing Fast Fourier Transforms (FFT) and linear optimization in C++. Participants seek recommendations for libraries and tutorials, and explore compatibility issues with different compilers.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant expresses a need for tutorials on implementing FFT and linear optimization in C++ due to limitations in MATLAB.
  • Another participant advises against writing custom algorithms for FFT and linear optimization, suggesting that existing libraries are likely superior.
  • A request for specific library recommendations is made, highlighting a lack of familiarity with C++ libraries compared to MATLAB.
  • Participants mention the FFTW library as a strong option for FFT algorithms and suggest BLAS or LAPACK++ for linear algebra functions.
  • Discussion includes the compatibility of various libraries with different compilers, noting that Intel's MLK has limited compatibility with Borland compilers.
  • One participant describes a specific function for Fourier transformation and expresses uncertainty about how to format it for FFTW input.
  • Clarification is provided that FFT requires an array of complex numbers as input, regardless of how the input function is computed.
  • There is a discussion about the relative performance and compatibility of different compilers, including MS C++ Visual Studio and Intel C++ Compiler.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether to write custom algorithms or rely on existing libraries, and there are differing opinions on compiler compatibility and performance.

Contextual Notes

Participants express uncertainty regarding the specific requirements for input formatting for FFTW and the limitations of Borland compilers in supporting advanced C++ features.

Who May Find This Useful

Individuals interested in implementing FFT and linear optimization in C++, particularly those transitioning from MATLAB or using older compilers like Borland.

orstats
Messages
14
Reaction score
0
Dear All:

I am finding that for the computational estimation that I need, I would not be able to do this in MATLAB. Is there a good tutorial that you would recommend for writing and running our own functions, such as inversion of fast Fourier transforms and linear optimization, in C++?


Thanks so much!
 
Technology news on Phys.org
I would not recommend writing your own FFT, inversion, or linear optimization algorithms. (unless of course it is required for a class). There are lots of libraries available to do those in C++ that will probably be much better than anything you would code yourself.
 
Ok, sounds encouraging. Which ones are they? Or is there a repository that I can look at? I am more familiar w. MATLAB. When I last programmed in C, I don't remember libraries we had access to other than the standard simple math functions. Does C++ offer more libraries then? Please kindly point where I may locate these libraries. The compiler is Borland 5.5...does that make a difference in the libraries I have available from the free download?
 
orstats said:
Or is there a repository that I can look at?
Uhh, Google?

Sorry, just teasing.

I would recommend the fftw library (fastest Fourier transform in the west) for a really good set of FFT algorithms as well as being my favorite name of any library I know :smile:. For linear algebra functions probably BLAS or LAPACK++ will be sufficient. If you are running on an AMD chipset then you could look at the ACML which has BLAS, LAPACK, FFT, random number generators, and basic math functions all in one package. I am sure that Intel has a similar library, but I haven't used it.
 
Last edited:
Thanks! I am running Intel Pentium duo-Core. I will check if they have these libraries. FFTW library won nice accolades. We are interested in the fwrd FT of this function at specific values of k. In our case, to be Fourier transformed function Xj is a complex expression that is a ratio of trig functions of i*sqrt(j). Being that my Xj is a function of the index j of the discrete summation I am not sure how this can be written as input for FFTW...
 
FYI: Intel also has MLK...its compiler compatibility is limited to MS C++ Visual Studio and Intel C++ Compiler and GCC. No Borland it looks like.
 
orstats said:
Being that my Xj is a function of the index j of the discrete summation I am not sure how this can be written as input for FFTW...
The FFT always takes an array (of complex numbers) as an input. So simply compute the value of your input function and store it in an array. It doesn't matter if computing your function involves a summation or not.
 
orstats said:
FYI: Intel also has MLK...its compiler compatibility is limited to MS C++ Visual Studio and Intel C++ Compiler and GCC. No Borland it looks like.
Typical of Microsoft.
 
DaleSpam said:
Typical of Microsoft.
To be fair, I recall that the Borland compilers have generally been lagging behind others in its support of more advanced C++ features.
 
  • #10
Okay, great. Which is better to download for compiler: MS C++ Visual Studio vs. Intel C++ Compiler when we're running on MS XP Duo-Core?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
1K
Replies
81
Views
8K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 17 ·
Replies
17
Views
5K
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K