0

I have a two dimensional matrix in both C++ and MATLAB. I want to apply just the one dimensional fft, along to one direction like in the following picture.

enter image description here

This is trivial in MATLAB and it can be done by the following format. I was wondering if it is possible to do the same fft transform in C++ with the fftw library. I know that it can be done with a for loop, along the desired direction, but if it can be done with one command it would be great.

Thanks for your help.

Alfabravo
  • 7,493
  • 6
  • 46
  • 82
Ilias
  • 31
  • 5
  • 1
    It's probably easiest to transpose the array first, to make the rows contiguous, then do a 1D FFT on each row, and finally transpose the result back again (if needed). The cost of the transpose is typically negligible compared to the cost of the FFT and the improved efficiency of operating on contiguous data. – Paul R Jun 13 '17 at 16:04
  • This is nice. Although this will require one for loop and I wanted to avoid it, maybe if fftw had an already implemented function that I didn't know about. Anyway, it seems that I can't achieve like that. Thanks a lot! – Ilias Jun 13 '17 at 16:33
  • 1
    You might find [this question and answer](https://stackoverflow.com/q/6021740/253056) helpful. – Paul R Jun 13 '17 at 16:34
  • Thanks a lot Paul R. – Ilias Jun 16 '17 at 15:56

0 Answers0