How to do it...

In this section, we are going to implement the Fourier transformation and its backward transformation and then play around with it to transform some signals:

  1. First, we include all the headers and declare that we use the std namespace:
      #include <iostream>      #include <complex>      #include <vector>      #include <algorithm>      #include <iterator>      #include <numeric>      #include <valarray>      #include <cmath>            using namespace std;
  1. A data point of a signal is a complex number and shall be represented by std::complex, specialized on the double type. This way, the type alias cmplx stands for two coupled double values, which represent the real and the imaginary parts of a complex number. A whole signal is a vector of such items, which we alias to ...

Get C++17 STL Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.