Search code examples
c++c++11fftfftw

2D FFT for Huge Matrix


I have 2d Vector with 2533136*8 dimension like below :

vector<vector<double>> DataChannel1(2533136, vector<double>(8));

I want to take FFT from this Vector with fastest solution but I don not How!

can you help me How can I do that?

In addition to I used FFTW library but with my dimension(ROW=2533136 and COL=8) Take long time to calculate.

const auto ROWS = 2533136;
const auto COLS = 8;
fftw_complex in[ROWS][COLS], out[ROWS][COLS];
fftw_plan g;


g = fftw_plan_dft_2d(ROWS, COLS, *in, *out, FFTW_FORWARD, FFTW_MEASURE);

Solution

  • My Problem Solved And I am very thanksful from @G.M., He/She is considering my problem. In My problem most of time spent in fftw_plan_dft_2d, I saw the FFTW documentation and understood the last input of this function is Planner Flags :

    fftw_plan fftw_plan_dft_2d(int n0, int n1,
                           fftw_complex *in, fftw_complex *out,
                           int sign, unsigned flags)
    

    All of the planner routines in FFTW accept an integer flags argument, which is a bitwise OR (‘|’) of zero or more of the flag constants defined below. These flags control the rigor (and time) of the planning process, and can also impose (or lift) restrictions on the type of transform algorithm that is employed.

    Planning-rigor flags

    FFTW_ESTIMATE specifies that, instead of actual measurements of different algorithms, a simple heuristic is used to pick a (probably sub-optimal) plan quickly. With this flag, the input/output arrays are not overwritten during planning.

    FFTW_MEASURE tells FFTW to find an optimized plan by actually computing several FFTs and measuring their execution time. Depending on your machine, this can take some time (often a few seconds). FFTW_MEASURE is the default planning option.